@aztec/end-to-end 3.0.0-canary.a9708bd → 3.0.0-devnet.3

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 (137) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +3 -2
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.d.ts +16 -12
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  5. package/dest/bench/client_flows/client_flows_benchmark.js +54 -58
  6. package/dest/bench/utils.d.ts +2 -11
  7. package/dest/bench/utils.d.ts.map +1 -1
  8. package/dest/bench/utils.js +10 -34
  9. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +7 -7
  10. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +42 -42
  12. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -8
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +31 -33
  15. package/dest/e2e_deploy_contract/deploy_test.d.ts +10 -4
  16. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  17. package/dest/e2e_deploy_contract/deploy_test.js +9 -18
  18. package/dest/e2e_epochs/epochs_test.d.ts +9 -3
  19. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.js +19 -13
  21. package/dest/e2e_fees/bridging_race.notest.js +12 -9
  22. package/dest/e2e_fees/fees_test.d.ts +5 -5
  23. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  24. package/dest/e2e_fees/fees_test.js +26 -33
  25. package/dest/e2e_l1_publisher/write_json.d.ts +3 -1
  26. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  27. package/dest/e2e_l1_publisher/write_json.js +5 -5
  28. package/dest/e2e_multi_validator/utils.d.ts +1 -1
  29. package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
  30. package/dest/e2e_multi_validator/utils.js +3 -9
  31. package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -3
  32. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  33. package/dest/e2e_nested_contract/nested_contract_test.js +7 -9
  34. package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
  35. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
  36. package/dest/e2e_p2p/inactivity_slash_test.js +135 -0
  37. package/dest/e2e_p2p/p2p_network.d.ts +22 -8
  38. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  39. package/dest/e2e_p2p/p2p_network.js +36 -15
  40. package/dest/e2e_p2p/shared.d.ts +12 -13
  41. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  42. package/dest/e2e_p2p/shared.js +54 -54
  43. package/dest/e2e_token_contract/token_contract_test.d.ts +5 -4
  44. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  45. package/dest/e2e_token_contract/token_contract_test.js +14 -17
  46. package/dest/fixtures/e2e_prover_test.d.ts +8 -6
  47. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  48. package/dest/fixtures/e2e_prover_test.js +42 -51
  49. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  50. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  51. package/dest/fixtures/get_bb_config.d.ts +1 -1
  52. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  53. package/dest/fixtures/get_bb_config.js +2 -2
  54. package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
  55. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  56. package/dest/fixtures/setup_l1_contracts.js +2 -2
  57. package/dest/fixtures/setup_p2p_test.d.ts +10 -9
  58. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  59. package/dest/fixtures/setup_p2p_test.js +38 -20
  60. package/dest/fixtures/snapshot_manager.d.ts +10 -7
  61. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  62. package/dest/fixtures/snapshot_manager.js +60 -47
  63. package/dest/fixtures/token_utils.d.ts +6 -4
  64. package/dest/fixtures/token_utils.d.ts.map +1 -1
  65. package/dest/fixtures/token_utils.js +11 -15
  66. package/dest/fixtures/utils.d.ts +26 -28
  67. package/dest/fixtures/utils.d.ts.map +1 -1
  68. package/dest/fixtures/utils.js +83 -109
  69. package/dest/fixtures/web3signer.d.ts +5 -0
  70. package/dest/fixtures/web3signer.d.ts.map +1 -0
  71. package/dest/fixtures/web3signer.js +53 -0
  72. package/dest/quality_of_service/alert_checker.d.ts +1 -1
  73. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  74. package/dest/shared/cross_chain_test_harness.d.ts +16 -10
  75. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  76. package/dest/shared/cross_chain_test_harness.js +13 -15
  77. package/dest/shared/gas_portal_test_harness.d.ts +9 -6
  78. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  79. package/dest/shared/gas_portal_test_harness.js +10 -7
  80. package/dest/shared/jest_setup.js +1 -1
  81. package/dest/shared/submit-transactions.d.ts +5 -3
  82. package/dest/shared/submit-transactions.d.ts.map +1 -1
  83. package/dest/shared/submit-transactions.js +8 -7
  84. package/dest/shared/uniswap_l1_l2.d.ts +9 -6
  85. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  86. package/dest/shared/uniswap_l1_l2.js +29 -45
  87. package/dest/simulators/lending_simulator.d.ts +2 -1
  88. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  89. package/dest/simulators/lending_simulator.js +3 -2
  90. package/dest/simulators/token_simulator.d.ts +3 -1
  91. package/dest/simulators/token_simulator.d.ts.map +1 -1
  92. package/dest/simulators/token_simulator.js +2 -2
  93. package/dest/spartan/setup_test_wallets.d.ts +19 -13
  94. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  95. package/dest/spartan/setup_test_wallets.js +108 -85
  96. package/dest/spartan/utils.d.ts +68 -3
  97. package/dest/spartan/utils.d.ts.map +1 -1
  98. package/dest/spartan/utils.js +312 -49
  99. package/package.json +39 -38
  100. package/src/bench/client_flows/benchmark.ts +6 -6
  101. package/src/bench/client_flows/client_flows_benchmark.ts +62 -82
  102. package/src/bench/client_flows/data_extractor.ts +1 -1
  103. package/src/bench/utils.ts +9 -37
  104. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
  105. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +33 -47
  106. package/src/e2e_deploy_contract/deploy_test.ts +17 -35
  107. package/src/e2e_epochs/epochs_test.ts +22 -19
  108. package/src/e2e_fees/bridging_race.notest.ts +14 -9
  109. package/src/e2e_fees/fees_test.ts +29 -40
  110. package/src/e2e_l1_publisher/write_json.ts +8 -6
  111. package/src/e2e_multi_validator/utils.ts +4 -10
  112. package/src/e2e_nested_contract/nested_contract_test.ts +11 -10
  113. package/src/e2e_p2p/inactivity_slash_test.ts +178 -0
  114. package/src/e2e_p2p/p2p_network.ts +110 -71
  115. package/src/e2e_p2p/shared.ts +57 -56
  116. package/src/e2e_token_contract/token_contract_test.ts +17 -17
  117. package/src/fixtures/e2e_prover_test.ts +52 -88
  118. package/src/fixtures/get_acvm_config.ts +1 -1
  119. package/src/fixtures/get_bb_config.ts +3 -2
  120. package/src/fixtures/setup_l1_contracts.ts +3 -3
  121. package/src/fixtures/setup_p2p_test.ts +60 -27
  122. package/src/fixtures/snapshot_manager.ts +80 -72
  123. package/src/fixtures/token_utils.ts +13 -21
  124. package/src/fixtures/utils.ts +95 -145
  125. package/src/fixtures/web3signer.ts +63 -0
  126. package/src/guides/up_quick_start.sh +2 -10
  127. package/src/quality_of_service/alert_checker.ts +1 -1
  128. package/src/shared/cross_chain_test_harness.ts +18 -29
  129. package/src/shared/gas_portal_test_harness.ts +12 -19
  130. package/src/shared/jest_setup.ts +1 -1
  131. package/src/shared/submit-transactions.ts +12 -8
  132. package/src/shared/uniswap_l1_l2.ts +61 -67
  133. package/src/simulators/lending_simulator.ts +3 -2
  134. package/src/simulators/token_simulator.ts +5 -2
  135. package/src/spartan/DEVELOP.md +8 -3
  136. package/src/spartan/setup_test_wallets.ts +133 -126
  137. package/src/spartan/utils.ts +373 -48
@@ -1,20 +1,9 @@
1
- import { EcdsaRAccountContractArtifact, getEcdsaRAccount } from '@aztec/accounts/ecdsa';
2
- import { SchnorrAccountContractArtifact, getSchnorrAccount, getSchnorrWallet } from '@aztec/accounts/schnorr';
3
- import {
4
- type AccountWallet,
5
- AccountWalletWithSecretKey,
6
- AztecAddress,
7
- type AztecNode,
8
- FeeJuicePaymentMethod,
9
- FeeJuicePaymentMethodWithClaim,
10
- type FeePaymentMethod,
11
- type Logger,
12
- type PXE,
13
- PrivateFeePaymentMethod,
14
- SponsoredFeePaymentMethod,
15
- type Wallet,
16
- createLogger,
17
- } from '@aztec/aztec.js';
1
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
3
+ import { type FeePaymentMethod, PrivateFeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
4
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
5
+ import type { AztecNode } from '@aztec/aztec.js/node';
6
+ import type { Wallet } from '@aztec/aztec.js/wallet';
18
7
  import { CheatCodes } from '@aztec/aztec/testing';
19
8
  import { type DeployL1ContractsArgs, RollupContract, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
20
9
  import { ChainMonitor } from '@aztec/ethereum/test';
@@ -30,8 +19,10 @@ import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
30
19
  import { TokenContract as BananaCoin, TokenContract } from '@aztec/noir-contracts.js/Token';
31
20
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
32
21
  import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
33
- import { type PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe/server';
22
+ import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
23
+ import { GasSettings } from '@aztec/stdlib/gas';
34
24
  import { deriveSigningKey } from '@aztec/stdlib/keys';
25
+ import { TestWallet } from '@aztec/test-wallet/server';
35
26
 
36
27
  import { MNEMONIC } from '../../fixtures/fixtures.js';
37
28
  import {
@@ -53,22 +44,21 @@ import { type ClientFlowsConfig, FULL_FLOWS_CONFIG, KEY_FLOWS_CONFIG } from './c
53
44
  const { E2E_DATA_PATH: dataPath, BENCHMARK_CONFIG } = process.env;
54
45
 
55
46
  export type AccountType = 'ecdsar1' | 'schnorr';
56
- export type FeePaymentMethodGetter = (wallet: Wallet) => Promise<FeePaymentMethod>;
47
+ export type FeePaymentMethodGetter = (wallet: Wallet, sender: AztecAddress) => Promise<FeePaymentMethod | undefined>;
57
48
  export type BenchmarkingFeePaymentMethod = 'bridged_fee_juice' | 'private_fpc' | 'sponsored_fpc' | 'fee_juice';
58
49
 
59
50
  export class ClientFlowsBenchmark {
60
51
  private snapshotManager: ISnapshotManager;
61
52
 
62
53
  public logger: Logger;
63
- public pxe!: PXE;
64
54
  public aztecNode!: AztecNode;
65
55
  public cheatCodes!: CheatCodes;
66
56
  public context!: SubsystemsContext;
67
57
  public chainMonitor!: ChainMonitor;
68
58
  public feeJuiceBridgeTestHarness!: GasBridgingTestHarness;
59
+ public adminWallet!: TestWallet;
69
60
 
70
61
  // The admin that aids in the setup of the test
71
- public adminWallet!: AccountWallet;
72
62
  public adminAddress!: AztecAddress;
73
63
 
74
64
  // Aztec Node config
@@ -89,8 +79,8 @@ export class ClientFlowsBenchmark {
89
79
  // Sponsored FPC contract
90
80
  public sponsoredFPC!: SponsoredFPCContract;
91
81
 
92
- // PXE used by the benchmarking user. It can be set up with client-side proving enabled
93
- public userPXE!: PXE;
82
+ // PXE and Wallet used by the benchmarking user. It can be set up with client-side proving enabled
83
+ public userWallet!: TestWallet;
94
84
 
95
85
  public realProofs = ['true', '1'].includes(process.env.REAL_PROOFS ?? '');
96
86
 
@@ -117,7 +107,7 @@ export class ClientFlowsBenchmark {
117
107
  },
118
108
  // eslint-disable-next-line camelcase
119
109
  fee_juice: {
120
- forWallet: this.getFeeJuicePaymentMethodForWallet.bind(this),
110
+ forWallet: () => Promise.resolve(undefined),
121
111
  circuits: 0,
122
112
  },
123
113
  };
@@ -169,7 +159,7 @@ export class ClientFlowsBenchmark {
169
159
  .balance_of_private(address)
170
160
  .simulate({ from: this.adminAddress });
171
161
 
172
- await mintTokensToPrivate(this.bananaCoin, this.adminAddress, this.adminWallet, address, amount);
162
+ await mintTokensToPrivate(this.bananaCoin, this.adminAddress, address, amount);
173
163
 
174
164
  const balanceAfter = await this.bananaCoin.methods
175
165
  .balance_of_private(address)
@@ -177,23 +167,20 @@ export class ClientFlowsBenchmark {
177
167
  expect(balanceAfter).toEqual(balanceBefore + amount);
178
168
  }
179
169
 
180
- async createBenchmarkingAccountManager(pxe: PXE, type: 'ecdsar1' | 'schnorr') {
181
- const benchysSecretKey = Fr.random();
170
+ createBenchmarkingAccountManager(wallet: TestWallet, type: 'ecdsar1' | 'schnorr') {
171
+ const benchysSecret = Fr.random();
182
172
  const salt = Fr.random();
183
173
 
184
174
  let benchysPrivateSigningKey;
185
- let benchysAccountManager;
186
175
  if (type === 'schnorr') {
187
- benchysPrivateSigningKey = deriveSigningKey(benchysSecretKey);
188
- benchysAccountManager = await getSchnorrAccount(pxe, benchysSecretKey, benchysPrivateSigningKey, salt);
176
+ benchysPrivateSigningKey = deriveSigningKey(benchysSecret);
177
+ return wallet.createSchnorrAccount(benchysSecret, salt, benchysPrivateSigningKey);
189
178
  } else if (type === 'ecdsar1') {
190
179
  benchysPrivateSigningKey = randomBytes(32);
191
- benchysAccountManager = await getEcdsaRAccount(pxe, benchysSecretKey, benchysPrivateSigningKey, salt);
180
+ return wallet.createECDSARAccount(benchysSecret, salt, benchysPrivateSigningKey);
192
181
  } else {
193
182
  throw new Error(`Unknown account type: ${type}`);
194
183
  }
195
- await benchysAccountManager.register();
196
- return benchysAccountManager;
197
184
  }
198
185
 
199
186
  public async applyBaseSnapshots() {
@@ -205,32 +192,28 @@ export class ClientFlowsBenchmark {
205
192
  await this.snapshotManager.snapshot(
206
193
  'initial_accounts',
207
194
  deployAccounts(2, this.logger),
208
- async ({ deployedAccounts }, { pxe, aztecNode, aztecNodeConfig }) => {
209
- this.pxe = pxe;
210
-
195
+ async (
196
+ { deployedAccounts: [{ address: adminAddress }, { address: sequencerAddress }] },
197
+ { wallet, aztecNode, cheatCodes },
198
+ ) => {
199
+ this.adminWallet = wallet;
211
200
  this.aztecNode = aztecNode;
212
- this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
201
+ this.cheatCodes = cheatCodes;
213
202
 
214
- const deployedWallets = await Promise.all(
215
- deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)),
216
- );
217
- [this.adminWallet] = deployedWallets;
218
- this.adminAddress = this.adminWallet.getAddress();
219
- this.sequencerAddress = deployedWallets[1].getAddress();
203
+ this.adminAddress = adminAddress;
204
+ this.sequencerAddress = sequencerAddress;
220
205
 
221
206
  const canonicalFeeJuice = await getCanonicalFeeJuice();
222
207
  this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.adminWallet);
223
208
  this.coinbase = EthAddress.random();
224
209
 
225
- const userPXEConfig = getPXEServiceConfig();
226
- const l1Contracts = await aztecNode.getL1ContractAddresses();
210
+ const userPXEConfig = getPXEConfig();
227
211
  const userPXEConfigWithContracts = {
228
212
  ...userPXEConfig,
229
213
  proverEnabled: this.realProofs,
230
- l1Contracts,
231
- } as PXEServiceConfig;
214
+ } as PXEConfig;
232
215
 
233
- this.userPXE = await createPXEService(this.aztecNode, userPXEConfigWithContracts, {
216
+ this.userWallet = await TestWallet.create(this.aztecNode, userPXEConfigWithContracts, {
234
217
  loggers: {
235
218
  prover: this.proxyLogger.createLogger('pxe:bb:wasm:bundle:proxied'),
236
219
  },
@@ -251,7 +234,6 @@ export class ClientFlowsBenchmark {
251
234
  this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
252
235
  aztecNode: context.aztecNode,
253
236
  aztecNodeAdmin: context.aztecNode,
254
- pxeService: context.pxe,
255
237
  l1Client: context.deployL1ContractsValues.l1Client,
256
238
  wallet: this.adminWallet,
257
239
  logger: this.logger,
@@ -297,7 +279,7 @@ export class ClientFlowsBenchmark {
297
279
  'fpc_setup',
298
280
  async context => {
299
281
  const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
300
- expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
282
+ expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
301
283
 
302
284
  const bananaCoin = this.bananaCoin;
303
285
  const bananaFPC = await FPCContract.deploy(this.adminWallet, bananaCoin.address, this.adminAddress)
@@ -320,7 +302,7 @@ export class ClientFlowsBenchmark {
320
302
  await this.snapshotManager.snapshot(
321
303
  'deploy_sponsored_fpc',
322
304
  async () => {
323
- const sponsoredFPC = await setupSponsoredFPC(this.pxe);
305
+ const sponsoredFPC = await setupSponsoredFPC(this.adminWallet);
324
306
  this.logger.info(`SponsoredFPC at ${sponsoredFPC.address}`);
325
307
  return { sponsoredFPCAddress: sponsoredFPC.address };
326
308
  },
@@ -330,7 +312,7 @@ export class ClientFlowsBenchmark {
330
312
  );
331
313
  }
332
314
 
333
- public async createCrossChainTestHarness(owner: AccountWallet) {
315
+ public async createCrossChainTestHarness(owner: AztecAddress) {
334
316
  const l1Client = createExtendedL1Client(this.context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
335
317
 
336
318
  const underlyingERC20Address = await deployL1Contract(l1Client, TestERC20Abi, TestERC20Bytecode, [
@@ -342,10 +324,9 @@ export class ClientFlowsBenchmark {
342
324
  this.logger.verbose(`Setting up cross chain harness...`);
343
325
  const crossChainTestHarness = await CrossChainTestHarness.new(
344
326
  this.aztecNode,
345
- this.pxe,
346
327
  l1Client,
328
+ this.adminWallet,
347
329
  owner,
348
- owner.getAddress(),
349
330
  this.logger,
350
331
  underlyingERC20Address,
351
332
  );
@@ -355,26 +336,25 @@ export class ClientFlowsBenchmark {
355
336
  return crossChainTestHarness;
356
337
  }
357
338
 
358
- public async createAndFundBenchmarkingWallet(accountType: AccountType) {
359
- const benchysAccountManager = await this.createBenchmarkingAccountManager(this.pxe, accountType);
360
- const benchysWallet = await benchysAccountManager.getWallet();
361
- const benchysAddress = benchysAccountManager.getAddress();
339
+ public async createAndFundBenchmarkingAccountOnUserWallet(accountType: AccountType) {
340
+ const benchysAccountManager = await this.createBenchmarkingAccountManager(this.adminWallet, accountType);
341
+ const benchysAccount = await benchysAccountManager.getAccount();
342
+ const benchysAddress = benchysAccountManager.address;
362
343
  const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(benchysAddress);
363
- const paymentMethod = new FeeJuicePaymentMethodWithClaim(benchysWallet, claim);
364
- await benchysAccountManager.deploy({ fee: { paymentMethod } }).wait();
365
- // Register benchy on the user's PXE, where we're going to be interacting from
366
- await this.userPXE.registerContract({
367
- instance: benchysAccountManager.getInstance(),
368
- artifact: accountType === 'ecdsar1' ? EcdsaRAccountContractArtifact : SchnorrAccountContractArtifact,
344
+ const behchysDeployMethod = await benchysAccountManager.getDeployMethod();
345
+ await behchysDeployMethod
346
+ .send({
347
+ from: AztecAddress.ZERO,
348
+ fee: { paymentMethod: new FeeJuicePaymentMethodWithClaim(benchysAddress, claim) },
349
+ })
350
+ .wait();
351
+ // Register benchy on the user's Wallet, where we're going to be interacting from
352
+ const accountManager = await this.userWallet.createAccount({
353
+ secret: benchysAccount.getSecretKey(),
354
+ salt: new Fr(benchysAccount.salt),
355
+ contract: benchysAccountManager.getAccountContract(),
369
356
  });
370
- await this.userPXE.registerAccount(benchysWallet.getSecretKey(), benchysWallet.getCompleteAddress().partialAddress);
371
- const entrypoint = await benchysAccountManager.getAccount();
372
- return new AccountWalletWithSecretKey(
373
- this.userPXE,
374
- entrypoint,
375
- benchysWallet.getSecretKey(),
376
- benchysAccountManager.salt,
377
- );
357
+ return accountManager.address;
378
358
  }
379
359
 
380
360
  public async applyDeployAmmSnapshot() {
@@ -403,20 +383,20 @@ export class ClientFlowsBenchmark {
403
383
  );
404
384
  }
405
385
 
406
- public async getBridgedFeeJuicePaymentMethodForWallet(wallet: Wallet) {
407
- const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(wallet.getAddress());
408
- return new FeeJuicePaymentMethodWithClaim(wallet, claim);
386
+ public async getBridgedFeeJuicePaymentMethodForWallet(_wallet: Wallet, sender: AztecAddress) {
387
+ const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(sender);
388
+ return new FeeJuicePaymentMethodWithClaim(sender, claim);
409
389
  }
410
390
 
411
- public getPrivateFPCPaymentMethodForWallet(wallet: Wallet) {
412
- return Promise.resolve(new PrivateFeePaymentMethod(this.bananaFPC.address, wallet));
391
+ public async getPrivateFPCPaymentMethodForWallet(wallet: Wallet, sender: AztecAddress) {
392
+ // The private fee paying method assembled on the app side requires knowledge of the maximum
393
+ // fee the user is willing to pay
394
+ const maxFeesPerGas = (await this.aztecNode.getCurrentBaseFees()).mul(1.5);
395
+ const gasSettings = GasSettings.default({ maxFeesPerGas });
396
+ return new PrivateFeePaymentMethod(this.bananaFPC.address, sender, wallet, gasSettings);
413
397
  }
414
398
 
415
- public getSponsoredFPCPaymentMethodForWallet(_wallet: Wallet) {
399
+ public getSponsoredFPCPaymentMethodForWallet(_wallet: Wallet, _sender: AztecAddress) {
416
400
  return Promise.resolve(new SponsoredFeePaymentMethod(this.sponsoredFPC.address));
417
401
  }
418
-
419
- public getFeeJuicePaymentMethodForWallet(wallet: Wallet) {
420
- return Promise.resolve(new FeeJuicePaymentMethod(wallet.getAddress()));
421
- }
422
402
  }
@@ -1,4 +1,4 @@
1
- import type { Logger } from '@aztec/aztec.js';
1
+ import type { Logger } from '@aztec/aztec.js/log';
2
2
  import { BBNativePrivateKernelProver } from '@aztec/bb-prover/client/native';
3
3
  import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
4
4
  import { createLogger, logger } from '@aztec/foundation/log';
@@ -1,8 +1,7 @@
1
1
  import type { AztecNodeService } from '@aztec/aztec-node';
2
- import { type AztecNode, BatchCall, type SentTx, type WaitOpts } from '@aztec/aztec.js';
2
+ import { BatchCall, type SentTx, type WaitOpts } from '@aztec/aztec.js/contracts';
3
3
  import { mean, stdDev, times } from '@aztec/foundation/collection';
4
4
  import { BenchmarkingContract } from '@aztec/noir-test-contracts.js/Benchmarking';
5
- import { type PXEService, type PXEServiceConfig, createPXEService } from '@aztec/pxe/server';
6
5
  import type { MetricsType } from '@aztec/telemetry-client';
7
6
  import type { BenchmarkDataPoint, BenchmarkMetricsType, BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
8
7
 
@@ -22,9 +21,8 @@ export async function benchmarkSetup(
22
21
  },
23
22
  ) {
24
23
  const context = await setup(1, { ...opts, telemetryConfig: { benchmark: true } });
25
- const contract = await BenchmarkingContract.deploy(context.wallet)
26
- .send({ from: context.wallet.getAddress() })
27
- .deployed();
24
+ const defaultAccountAddress = context.accounts[0];
25
+ const contract = await BenchmarkingContract.deploy(context.wallet).send({ from: defaultAccountAddress }).deployed();
28
26
  context.logger.info(`Deployed benchmarking contract at ${contract.address}`);
29
27
  const sequencer = (context.aztecNode as AztecNodeService).getSequencer()!;
30
28
  const telemetry = context.telemetryClient! as BenchmarkTelemetryClient;
@@ -111,9 +109,9 @@ function makeCall(
111
109
  contract: BenchmarkingContract,
112
110
  heavyPublicCompute: boolean,
113
111
  ) {
114
- const owner = context.wallet.getAddress();
112
+ const [owner] = context.accounts;
115
113
  if (heavyPublicCompute) {
116
- return new BatchCall(context.wallet, [contract.methods.sha256_hash_2048(randomBytesAsBigInts(2048))]);
114
+ return new BatchCall(context.wallet, [contract.methods.sha256_hash_1024(randomBytesAsBigInts(1024))]);
117
115
  } else {
118
116
  return new BatchCall(context.wallet, [
119
117
  contract.methods.create_note(owner, index + 1),
@@ -131,17 +129,17 @@ function makeCall(
131
129
  * @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
132
130
  * @returns Array of sent txs.
133
131
  */
134
- export async function sendTxs(
132
+ export function sendTxs(
135
133
  txCount: number,
136
134
  context: EndToEndContext,
137
135
  contract: BenchmarkingContract,
138
136
  heavyPublicCompute: boolean = false,
139
- ): Promise<SentTx[]> {
137
+ ): SentTx[] {
140
138
  const calls = times(txCount, index => makeCall(index, context, contract, heavyPublicCompute));
141
139
  context.logger.info(`Creating ${txCount} txs`);
142
- const provenTxs = await Promise.all(calls.map(call => call.prove({ from: context.wallet.getAddress() })));
140
+ const [from] = context.accounts;
143
141
  context.logger.info(`Sending ${txCount} txs`);
144
- return provenTxs.map(tx => tx.send());
142
+ return calls.map(call => call.send({ from }));
145
143
  }
146
144
 
147
145
  export async function waitTxs(txs: SentTx[], context: EndToEndContext, txWaitOpts?: WaitOpts) {
@@ -150,32 +148,6 @@ export async function waitTxs(txs: SentTx[], context: EndToEndContext, txWaitOpt
150
148
  context.logger.info(`All ${txs.length} txs have been mined`);
151
149
  }
152
150
 
153
- /**
154
- * Creates a new PXE
155
- * @param node - Node to connect the pxe to.
156
- * @param contract - Benchmark contract to add to the pxe.
157
- * @param startingBlock - First l2 block to process.
158
- * @returns The new PXE.
159
- */
160
- export async function createNewPXE(node: AztecNode, contract: BenchmarkingContract): Promise<PXEService> {
161
- const l1Contracts = await node.getL1ContractAddresses();
162
- const { l1ChainId, rollupVersion } = await node.getNodeInfo();
163
- const pxeConfig = {
164
- l2BlockBatchSize: 50,
165
- l2BlockPollingIntervalMS: 100,
166
- dataDirectory: undefined,
167
- dataStoreMapSizeKB: 1024 * 1024,
168
- l1Contracts,
169
- l1ChainId,
170
- rollupVersion,
171
- } as PXEServiceConfig;
172
- // docs:start:PXEcreate
173
- const pxe = await createPXEService(node, pxeConfig);
174
- // docs:end:PXEcreate
175
- await pxe.registerContract(contract);
176
- return pxe;
177
- }
178
-
179
151
  function randomBytesAsBigInts(length: number): bigint[] {
180
152
  return [...Array(length)].map(_ => BigInt(Math.floor(Math.random() * 255)));
181
153
  }
@@ -1,21 +1,15 @@
1
- import { getSchnorrWallet } from '@aztec/accounts/schnorr';
2
- import {
3
- type AccountWallet,
4
- AztecAddress,
5
- type AztecNode,
6
- type CompleteAddress,
7
- Fr,
8
- type Logger,
9
- type PXE,
10
- type TxHash,
11
- computeSecretHash,
12
- createLogger,
13
- } from '@aztec/aztec.js';
1
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import { computeSecretHash } from '@aztec/aztec.js/crypto';
3
+ import { Fr } from '@aztec/aztec.js/fields';
4
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
5
+ import type { AztecNode } from '@aztec/aztec.js/node';
6
+ import type { TxHash } from '@aztec/aztec.js/tx';
14
7
  import type { CheatCodes } from '@aztec/aztec/testing';
15
8
  import type { TokenContract } from '@aztec/noir-contracts.js/Token';
16
9
  import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
17
10
  import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
18
11
  import type { SequencerClient } from '@aztec/sequencer-client';
12
+ import type { TestWallet } from '@aztec/test-wallet/server';
19
13
 
20
14
  import { jest } from '@jest/globals';
21
15
 
@@ -63,9 +57,7 @@ export class BlacklistTokenContractTest {
63
57
 
64
58
  private snapshotManager: ISnapshotManager;
65
59
  logger: Logger;
66
- wallets: AccountWallet[] = [];
67
- pxe!: PXE;
68
- accounts: CompleteAddress[] = [];
60
+ wallet!: TestWallet;
69
61
  asset!: TokenBlacklistContract;
70
62
  tokenSim!: TokenSimulator;
71
63
  badAccount!: InvalidAccountContract;
@@ -73,11 +65,8 @@ export class BlacklistTokenContractTest {
73
65
  sequencer!: SequencerClient;
74
66
  aztecNode!: AztecNode;
75
67
 
76
- admin!: AccountWallet;
77
68
  adminAddress!: AztecAddress;
78
- other!: AccountWallet;
79
69
  otherAddress!: AztecAddress;
80
- blacklisted!: AccountWallet;
81
70
  blacklistedAddress!: AztecAddress;
82
71
 
83
72
  constructor(testName: string) {
@@ -105,19 +94,15 @@ export class BlacklistTokenContractTest {
105
94
  await this.snapshotManager.snapshot(
106
95
  '3_accounts',
107
96
  deployAccounts(3, this.logger),
108
- async ({ deployedAccounts }, { pxe, cheatCodes, aztecNode, sequencer }) => {
109
- this.pxe = pxe;
97
+ ({ deployedAccounts }, { cheatCodes, aztecNode, sequencer, wallet }) => {
110
98
  this.cheatCodes = cheatCodes;
111
99
  this.aztecNode = aztecNode;
112
100
  this.sequencer = sequencer;
113
- this.wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
114
- this.admin = this.wallets[0];
115
- this.adminAddress = this.admin.getAddress();
116
- this.other = this.wallets[1];
117
- this.otherAddress = this.other.getAddress();
118
- this.blacklisted = this.wallets[2];
119
- this.blacklistedAddress = this.blacklisted.getAddress();
120
- this.accounts = this.wallets.map(w => w.getCompleteAddress());
101
+ this.wallet = wallet;
102
+ this.adminAddress = deployedAccounts[0].address;
103
+ this.otherAddress = deployedAccounts[1].address;
104
+ this.blacklistedAddress = deployedAccounts[2].address;
105
+ return Promise.resolve();
121
106
  },
122
107
  );
123
108
 
@@ -127,16 +112,16 @@ export class BlacklistTokenContractTest {
127
112
  // Create the token contract state.
128
113
  // Move this account thing to addAccounts above?
129
114
  this.logger.verbose(`Public deploy accounts...`);
130
- await publicDeployAccounts(this.admin, this.accounts.slice(0, 3));
115
+ await publicDeployAccounts(this.wallet, [this.adminAddress, this.otherAddress, this.blacklistedAddress]);
131
116
 
132
117
  this.logger.verbose(`Deploying TokenContract...`);
133
- this.asset = await TokenBlacklistContract.deploy(this.admin, this.adminAddress)
118
+ this.asset = await TokenBlacklistContract.deploy(this.wallet, this.adminAddress)
134
119
  .send({ from: this.adminAddress })
135
120
  .deployed();
136
121
  this.logger.verbose(`Token deployed to ${this.asset.address}`);
137
122
 
138
123
  this.logger.verbose(`Deploying bad account...`);
139
- this.badAccount = await InvalidAccountContract.deploy(this.admin).send({ from: this.adminAddress }).deployed();
124
+ this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({ from: this.adminAddress }).deployed();
140
125
  this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
141
126
 
142
127
  await this.crossTimestampOfChange();
@@ -145,18 +130,18 @@ export class BlacklistTokenContractTest {
145
130
  },
146
131
  async ({ tokenContractAddress, badAccountAddress }) => {
147
132
  // Restore the token contract state.
148
- this.asset = await TokenBlacklistContract.at(tokenContractAddress, this.wallets[0]);
133
+ this.asset = await TokenBlacklistContract.at(tokenContractAddress, this.wallet);
149
134
  this.logger.verbose(`Token contract address: ${this.asset.address}`);
150
135
 
151
136
  this.tokenSim = new TokenSimulator(
152
137
  this.asset as unknown as TokenContract,
153
- this.admin,
138
+ this.wallet,
154
139
  this.adminAddress,
155
140
  this.logger,
156
- this.accounts.map(a => a.address),
141
+ [this.adminAddress, this.otherAddress, this.blacklistedAddress],
157
142
  );
158
143
 
159
- this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallets[0]);
144
+ this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallet);
160
145
  this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
161
146
 
162
147
  expect(await this.asset.methods.get_roles(this.adminAddress).simulate({ from: this.adminAddress })).toEqual(
@@ -187,7 +172,7 @@ export class BlacklistTokenContractTest {
187
172
  secretHash: Fr,
188
173
  txHash: TxHash,
189
174
  ) {
190
- const txEffects = await this.pxe.getTxEffect(txHash);
175
+ const txEffects = await this.aztecNode.getTxEffect(txHash);
191
176
  await contract.methods
192
177
  .deliver_transparent_note(
193
178
  contract.address,
@@ -205,40 +190,38 @@ export class BlacklistTokenContractTest {
205
190
  await this.snapshotManager.snapshot(
206
191
  'mint',
207
192
  async () => {
208
- const { asset, accounts, wallets } = this;
193
+ const { asset } = this;
209
194
  const amount = 10000n;
210
195
 
211
196
  const adminMinterRole = new Role().withAdmin().withMinter();
212
- await this.asset
213
- .withWallet(this.admin)
214
- .methods.update_roles(this.admin.getAddress(), adminMinterRole.toNoirStruct())
197
+ await this.asset.methods
198
+ .update_roles(this.adminAddress, adminMinterRole.toNoirStruct())
215
199
  .send({ from: this.adminAddress })
216
200
  .wait();
217
201
 
218
202
  const blacklistRole = new Role().withBlacklisted();
219
- await this.asset
220
- .withWallet(this.admin)
221
- .methods.update_roles(this.blacklisted.getAddress(), blacklistRole.toNoirStruct())
203
+ await this.asset.methods
204
+ .update_roles(this.blacklistedAddress, blacklistRole.toNoirStruct())
222
205
  .send({ from: this.adminAddress })
223
206
  .wait();
224
207
 
225
208
  await this.crossTimestampOfChange();
226
209
 
227
- expect(
228
- await this.asset.methods.get_roles(this.admin.getAddress()).simulate({ from: this.adminAddress }),
229
- ).toEqual(adminMinterRole.toNoirStruct());
210
+ expect(await this.asset.methods.get_roles(this.adminAddress).simulate({ from: this.adminAddress })).toEqual(
211
+ adminMinterRole.toNoirStruct(),
212
+ );
230
213
 
231
214
  this.logger.verbose(`Minting ${amount} publicly...`);
232
- await asset.methods.mint_public(accounts[0].address, amount).send({ from: this.adminAddress }).wait();
215
+ await asset.methods.mint_public(this.adminAddress, amount).send({ from: this.adminAddress }).wait();
233
216
 
234
217
  this.logger.verbose(`Minting ${amount} privately...`);
235
218
  const secret = Fr.random();
236
219
  const secretHash = await computeSecretHash(secret);
237
220
  const receipt = await asset.methods.mint_private(amount, secretHash).send({ from: this.adminAddress }).wait();
238
221
 
239
- await this.addPendingShieldNoteToPXE(asset, wallets[0].getAddress(), amount, secretHash, receipt.txHash);
222
+ await this.addPendingShieldNoteToPXE(asset, this.adminAddress, amount, secretHash, receipt.txHash);
240
223
  const txClaim = asset.methods
241
- .redeem_shield(accounts[0].address, amount, secret)
224
+ .redeem_shield(this.adminAddress, amount, secret)
242
225
  .send({ from: this.adminAddress });
243
226
  await txClaim.wait();
244
227
  this.logger.verbose(`Minting complete.`);
@@ -246,23 +229,23 @@ export class BlacklistTokenContractTest {
246
229
  return { amount };
247
230
  },
248
231
  async ({ amount }) => {
249
- const {
250
- asset,
251
- accounts: [{ address }],
252
- tokenSim,
253
- } = this;
254
- tokenSim.mintPublic(address, amount);
255
-
256
- const publicBalance = await asset.methods.balance_of_public(address).simulate({ from: address });
232
+ const { asset, tokenSim } = this;
233
+ tokenSim.mintPublic(this.adminAddress, amount);
234
+
235
+ const publicBalance = await asset.methods
236
+ .balance_of_public(this.adminAddress)
237
+ .simulate({ from: this.adminAddress });
257
238
  this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
258
- expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
239
+ expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(this.adminAddress));
259
240
 
260
- tokenSim.mintPrivate(address, amount);
261
- const privateBalance = await asset.methods.balance_of_private(address).simulate({ from: address });
241
+ tokenSim.mintPrivate(this.adminAddress, amount);
242
+ const privateBalance = await asset.methods
243
+ .balance_of_private(this.adminAddress)
244
+ .simulate({ from: this.adminAddress });
262
245
  this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
263
- expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
246
+ expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(this.adminAddress));
264
247
 
265
- const totalSupply = await asset.methods.total_supply().simulate({ from: address });
248
+ const totalSupply = await asset.methods.total_supply().simulate({ from: this.adminAddress });
266
249
  this.logger.verbose(`Total supply: ${totalSupply}`);
267
250
  expect(totalSupply).toEqual(tokenSim.totalSupply);
268
251