@aztec/end-to-end 0.0.1-fake-c83136db25 → 0.0.1-fake-ceab37513c

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