@aztec/end-to-end 3.0.0-nightly.20250923 → 3.0.0-nightly.20250925

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 (55) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +1 -1
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +6 -10
  4. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
  5. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  6. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +1 -1
  7. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  8. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +1 -2
  9. package/dest/e2e_deploy_contract/deploy_test.d.ts +1 -1
  10. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  11. package/dest/e2e_fees/fees_test.d.ts +1 -1
  12. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  13. package/dest/e2e_fees/fees_test.js +2 -3
  14. package/dest/e2e_p2p/p2p_network.d.ts +1 -1
  15. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  16. package/dest/e2e_p2p/p2p_network.js +2 -4
  17. package/dest/e2e_p2p/shared.d.ts +5 -11
  18. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  19. package/dest/e2e_p2p/shared.js +36 -32
  20. package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
  21. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  22. package/dest/fixtures/e2e_prover_test.d.ts +1 -1
  23. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  24. package/dest/fixtures/setup_p2p_test.d.ts +0 -7
  25. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  26. package/dest/fixtures/snapshot_manager.d.ts +1 -1
  27. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  28. package/dest/fixtures/snapshot_manager.js +13 -15
  29. package/dest/fixtures/utils.d.ts +1 -7
  30. package/dest/fixtures/utils.d.ts.map +1 -1
  31. package/dest/fixtures/utils.js +25 -53
  32. package/dest/shared/submit-transactions.d.ts +1 -1
  33. package/dest/shared/submit-transactions.d.ts.map +1 -1
  34. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  35. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  36. package/dest/spartan/setup_test_wallets.d.ts +3 -3
  37. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  38. package/dest/spartan/setup_test_wallets.js +26 -21
  39. package/package.json +37 -37
  40. package/src/bench/client_flows/client_flows_benchmark.ts +5 -8
  41. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +1 -1
  42. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +2 -2
  43. package/src/e2e_deploy_contract/deploy_test.ts +1 -1
  44. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  45. package/src/e2e_fees/fees_test.ts +3 -3
  46. package/src/e2e_p2p/p2p_network.ts +55 -61
  47. package/src/e2e_p2p/shared.ts +40 -30
  48. package/src/e2e_token_contract/token_contract_test.ts +1 -1
  49. package/src/fixtures/e2e_prover_test.ts +1 -1
  50. package/src/fixtures/setup_p2p_test.ts +0 -8
  51. package/src/fixtures/snapshot_manager.ts +15 -16
  52. package/src/fixtures/utils.ts +25 -55
  53. package/src/shared/submit-transactions.ts +1 -1
  54. package/src/shared/uniswap_l1_l2.ts +1 -1
  55. package/src/spartan/setup_test_wallets.ts +20 -28
@@ -1,5 +1,5 @@
1
1
  import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
- import { type InitialAccountData, generateSchnorrAccounts, getDeployedTestAccounts } from '@aztec/accounts/testing';
2
+ import { type InitialAccountData, generateSchnorrAccounts, getInitialTestAccountsData } from '@aztec/accounts/testing';
3
3
  import { type Archiver, createArchiver } from '@aztec/archiver';
4
4
  import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
5
5
  import {
@@ -11,10 +11,8 @@ import {
11
11
  type Wallet,
12
12
  createAztecNodeClient,
13
13
  createLogger,
14
- createPXEClient,
15
- makeFetch,
16
14
  sleep,
17
- waitForPXE,
15
+ waitForNode,
18
16
  } from '@aztec/aztec.js';
19
17
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
20
18
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
@@ -56,11 +54,9 @@ import type { P2PClientDeps } from '@aztec/p2p';
56
54
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
57
55
  import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
58
56
  import { type ProverNode, type ProverNodeConfig, type ProverNodeDeps, createProverNode } from '@aztec/prover-node';
59
- import { type PXEServiceConfig, createPXEServiceWithSimulator, getPXEServiceConfig } from '@aztec/pxe/server';
57
+ import { type PXEServiceConfig, getPXEServiceConfig } from '@aztec/pxe/server';
60
58
  import type { SequencerClient } from '@aztec/sequencer-client';
61
59
  import type { TestSequencerClient } from '@aztec/sequencer-client/test';
62
- import { MemoryCircuitRecorder, SimulatorRecorderWrapper, WASMSimulator } from '@aztec/simulator/client';
63
- import { FileCircuitRecorder } from '@aztec/simulator/testing';
64
60
  import {
65
61
  type ContractInstanceWithAddress,
66
62
  getContractClassFromArtifact,
@@ -77,7 +73,7 @@ import {
77
73
  initTelemetryClient,
78
74
  } from '@aztec/telemetry-client';
79
75
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
80
- import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet';
76
+ import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
81
77
  import { getGenesisValues } from '@aztec/world-state/testing';
82
78
 
83
79
  import type { Anvil } from '@viem/anvil';
@@ -97,8 +93,8 @@ import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
97
93
  export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
98
94
  export { startAnvil };
99
95
 
100
- const { PXE_URL = '' } = process.env;
101
- const getAztecUrl = () => PXE_URL;
96
+ const { AZTEC_NODE_URL = '' } = process.env;
97
+ const getAztecUrl = () => AZTEC_NODE_URL;
102
98
 
103
99
  let telemetry: TelemetryClient | undefined = undefined;
104
100
  function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
@@ -178,18 +174,11 @@ export async function setupPXEServiceAndGetWallet(
178
174
  pxeServiceConfig.dataDirectory = path.join(tmpdir(), randomBytes(8).toString('hex'));
179
175
  }
180
176
 
181
- const simulator = new WASMSimulator();
182
- const recorder = process.env.CIRCUIT_RECORD_DIR
183
- ? new FileCircuitRecorder(process.env.CIRCUIT_RECORD_DIR)
184
- : new MemoryCircuitRecorder();
185
- const simulatorWithRecorder = new SimulatorRecorderWrapper(simulator, recorder);
186
- const pxe = await createPXEServiceWithSimulator(aztecNode, simulatorWithRecorder, pxeServiceConfig, {
187
- useLogSuffix,
188
- });
189
-
190
177
  const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(pxeServiceConfig.dataDirectory!);
191
178
 
192
- const wallet = new TestWallet(pxe, aztecNode);
179
+ const wallet = await TestWallet.create(aztecNode, pxeServiceConfig, {
180
+ useLogSuffix,
181
+ });
193
182
 
194
183
  return {
195
184
  wallet,
@@ -217,11 +206,9 @@ async function setupWithRemoteEnvironment(
217
206
  const aztecNodeUrl = getAztecUrl();
218
207
  logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
219
208
  const aztecNode = createAztecNodeClient(aztecNodeUrl);
220
- logger.verbose(`Creating PXE client to remote host ${PXE_URL}`);
221
- const pxeClient = createPXEClient(PXE_URL, {}, makeFetch([1, 2, 3], true));
222
- await waitForPXE(pxeClient, logger);
223
- logger.verbose('JSON RPC client connected to PXE');
224
- logger.verbose(`Retrieving contract addresses from ${PXE_URL}`);
209
+ await waitForNode(aztecNode, logger);
210
+ logger.verbose('JSON RPC client connected to Aztec Node');
211
+ logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
225
212
  const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
226
213
 
227
214
  const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
@@ -231,13 +218,13 @@ async function setupWithRemoteEnvironment(
231
218
  l1Client,
232
219
  rollupVersion,
233
220
  };
234
- const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls);
235
- const wallet = new TestWallet(pxeClient, aztecNode);
236
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, wallet, aztecNode);
221
+ const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
222
+ const wallet = await TestWallet.create(aztecNode);
223
+ const cheatCodes = await CheatCodes.create(config.l1RpcUrls, wallet, aztecNode, new DateProvider());
237
224
  const teardown = () => Promise.resolve();
238
225
 
239
226
  logger.verbose('Populating wallet from already registered accounts...');
240
- const initialFundedAccounts = await getDeployedTestAccounts(wallet);
227
+ const initialFundedAccounts = await getInitialTestAccountsData();
241
228
 
242
229
  if (initialFundedAccounts.length < numberOfAccounts) {
243
230
  throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
@@ -404,9 +391,9 @@ export async function setup(
404
391
  if (!isAnvilTestChain(chain.id)) {
405
392
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
406
393
  }
407
- if (PXE_URL) {
394
+ if (AZTEC_NODE_URL) {
408
395
  throw new Error(
409
- `PXE_URL provided but no ETHEREUM_HOSTS set. Refusing to run, please set both variables so tests can deploy L1 contracts to the same Anvil instance`,
396
+ `AZTEC_NODE_URL provided but no ETHEREUM_HOSTS set. Refusing to run, please set both variables so tests can deploy L1 contracts to the same Anvil instance`,
410
397
  );
411
398
  }
412
399
 
@@ -426,7 +413,8 @@ export async function setup(
426
413
  setupMetricsLogger(filename);
427
414
  }
428
415
 
429
- const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls);
416
+ const dateProvider = new TestDateProvider();
417
+ const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
430
418
 
431
419
  if (opts.stateLoad) {
432
420
  await ethCheatCodes.loadChainState(opts.stateLoad);
@@ -458,7 +446,7 @@ export async function setup(
458
446
 
459
447
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
460
448
 
461
- if (PXE_URL) {
449
+ if (AZTEC_NODE_URL) {
462
450
  // we are setting up against a remote environment, l1 contracts are assumed to already be deployed
463
451
  return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts);
464
452
  }
@@ -527,6 +515,7 @@ export async function setup(
527
515
  if (enableAutomine) {
528
516
  await ethCheatCodes.setAutomine(false);
529
517
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
518
+ dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
530
519
  }
531
520
 
532
521
  if (opts.l2StartTime) {
@@ -535,11 +524,8 @@ export async function setup(
535
524
  await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
536
525
  }
537
526
 
538
- const dateProvider = new TestDateProvider();
539
- dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
540
-
541
527
  const watcher = new AnvilTestWatcher(
542
- new EthCheatCodesWithState(config.l1RpcUrls),
528
+ new EthCheatCodesWithState(config.l1RpcUrls, dateProvider),
543
529
  deployL1ContractsValues.l1ContractAddresses.rollupAddress,
544
530
  deployL1ContractsValues.l1Client,
545
531
  dateProvider,
@@ -650,16 +636,14 @@ export async function setup(
650
636
  logger.verbose('Creating a pxe...');
651
637
  const { wallet, teardown: pxeTeardown } = await setupPXEServiceAndGetWallet(aztecNode!, pxeOpts, logger);
652
638
 
653
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, wallet, aztecNode);
639
+ const cheatCodes = await CheatCodes.create(config.l1RpcUrls, wallet, aztecNode, dateProvider);
654
640
 
655
641
  if (
656
642
  (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
657
643
  (opts.initialValidators && opts.initialValidators.length > 0)
658
644
  ) {
659
645
  // We need to advance such that the committee is set up.
660
- await cheatCodes.rollup.advanceToEpoch((await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochs + 1), {
661
- updateDateProvider: dateProvider,
662
- });
646
+ await cheatCodes.rollup.advanceToEpoch((await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochs + 1));
663
647
  await cheatCodes.rollup.setupEpoch();
664
648
  await cheatCodes.rollup.debugRollup();
665
649
  }
@@ -780,20 +764,6 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
780
764
  }
781
765
  // docs:end:public_deploy_accounts
782
766
 
783
- /**
784
- * Sets the timestamp of the next block.
785
- * @param rpcUrl - rpc url of the blockchain instance to connect to
786
- * @param timestamp - the timestamp for the next block
787
- */
788
- export async function setNextBlockTimestamp(rpcUrl: string, timestamp: number) {
789
- const params = `[${timestamp}]`;
790
- await fetch(rpcUrl, {
791
- body: `{"jsonrpc":"2.0", "method": "evm_setNextBlockTimestamp", "params": ${params}, "id": 1}`,
792
- method: 'POST',
793
- headers: { 'Content-Type': 'application/json' },
794
- });
795
- }
796
-
797
767
  /** Returns the job name for the current test. */
798
768
  function getJobName() {
799
769
  return process.env.JOB_NAME ?? expect.getState().currentTestName?.split(' ')[0].replaceAll('/', '_') ?? 'unknown';
@@ -1,6 +1,6 @@
1
1
  import { AztecAddress, Fr, GrumpkinScalar, type Logger, type SentTx, TxStatus } from '@aztec/aztec.js';
2
2
  import { times } from '@aztec/foundation/collection';
3
- import type { TestWallet } from '@aztec/test-wallet';
3
+ import type { TestWallet } from '@aztec/test-wallet/server';
4
4
 
5
5
  // submits a set of transactions to the provided Wallet
6
6
  export const submitTxsTo = async (
@@ -20,7 +20,7 @@ import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-art
20
20
  import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
21
21
  import { computeL2ToL1MessageHash } from '@aztec/stdlib/hash';
22
22
  import { computeL2ToL1MembershipWitness } from '@aztec/stdlib/messaging';
23
- import type { TestWallet } from '@aztec/test-wallet';
23
+ import type { TestWallet } from '@aztec/test-wallet/server';
24
24
 
25
25
  import { jest } from '@jest/globals';
26
26
  import { type GetContractReturnType, getContract, parseEther, toFunctionSelector } from 'viem';
@@ -1,4 +1,4 @@
1
- import { generateSchnorrAccounts, getDeployedTestAccounts } from '@aztec/accounts/testing';
1
+ import { generateSchnorrAccounts } from '@aztec/accounts/testing';
2
2
  import {
3
3
  type AztecAddress,
4
4
  type AztecNode,
@@ -9,15 +9,14 @@ import {
9
9
  SponsoredFeePaymentMethod,
10
10
  type Wallet,
11
11
  createAztecNodeClient,
12
- createCompatibleClient,
13
12
  retryUntil,
14
13
  } from '@aztec/aztec.js';
15
14
  import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
16
15
  import type { Logger } from '@aztec/foundation/log';
17
16
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
18
- import { createPXEService } from '@aztec/pxe/server';
19
17
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
20
- import { TestWallet } from '@aztec/test-wallet';
18
+ import { registerInitialSandboxAccountsInWallet } from '@aztec/test-wallet';
19
+ import { TestWallet } from '@aztec/test-wallet/server';
21
20
 
22
21
  import { getACVMConfig } from '../fixtures/get_acvm_config.js';
23
22
  import { getBBConfig } from '../fixtures/get_bb_config.js';
@@ -39,39 +38,33 @@ const TOKEN_SYMBOL = 'USD';
39
38
  const TOKEN_DECIMALS = 18n;
40
39
 
41
40
  export async function setupTestAccountsWithTokens(
42
- pxeUrl: string,
43
41
  nodeUrl: string,
44
42
  mintAmount: bigint,
45
43
  logger: Logger,
46
44
  ): Promise<TestAccounts> {
47
45
  const ACCOUNT_COUNT = 1; // TODO fix this to allow for 16 wallets again
48
46
 
49
- const pxe = await createCompatibleClient(pxeUrl, logger);
50
47
  const aztecNode = createAztecNodeClient(nodeUrl);
51
- const wallet = new TestWallet(pxe, aztecNode);
48
+ const wallet = await TestWallet.create(aztecNode);
52
49
 
53
- const [recipientAccount, ...accounts] = (await getDeployedTestAccounts(wallet)).slice(0, ACCOUNT_COUNT + 1);
50
+ const [recipientAccount, ...accounts] = (await registerInitialSandboxAccountsInWallet(wallet)).slice(
51
+ 0,
52
+ ACCOUNT_COUNT + 1,
53
+ );
54
54
 
55
55
  const tokenAdmin = accounts[0];
56
- const tokenAddress = await deployTokenAndMint(
57
- wallet,
58
- accounts.map(acc => acc.address),
59
- tokenAdmin.address,
60
- mintAmount,
61
- undefined,
62
- logger,
63
- );
56
+ const tokenAddress = await deployTokenAndMint(wallet, accounts, tokenAdmin, mintAmount, undefined, logger);
64
57
  const tokenContract = await TokenContract.at(tokenAddress, wallet);
65
58
 
66
59
  return {
67
60
  aztecNode,
68
- accounts: accounts.map(acc => acc.address),
61
+ accounts,
69
62
  wallet,
70
- tokenAdminAddress: tokenAdmin.address,
63
+ tokenAdminAddress: tokenAdmin,
71
64
  tokenName: TOKEN_NAME,
72
65
  tokenAddress,
73
66
  tokenContract,
74
- recipientAddress: recipientAccount.address,
67
+ recipientAddress: recipientAccount,
75
68
  };
76
69
  }
77
70
 
@@ -88,10 +81,11 @@ export async function deploySponsoredTestAccounts(
88
81
 
89
82
  await registerSponsoredFPC(wallet);
90
83
 
84
+ const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
85
+ await recipientAccount.deploy({ fee: { paymentMethod } }).wait({ timeout: 2400 });
91
86
  await Promise.all(
92
87
  fundedAccounts.map(async a => {
93
- const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
94
- await recipientAccount.deploy({ fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
88
+ await a.deploy({ fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
95
89
  logger.info(`Account deployed at ${a.getAddress()}`);
96
90
  }),
97
91
  );
@@ -120,7 +114,6 @@ export async function deploySponsoredTestAccounts(
120
114
  }
121
115
 
122
116
  export async function deployTestAccountsWithTokens(
123
- pxeUrl: string,
124
117
  nodeUrl: string,
125
118
  l1RpcUrls: string[],
126
119
  mnemonicOrPrivateKey: string,
@@ -128,9 +121,8 @@ export async function deployTestAccountsWithTokens(
128
121
  logger: Logger,
129
122
  numberOfFundedWallets = 1,
130
123
  ): Promise<TestAccounts> {
131
- const pxe = await createCompatibleClient(pxeUrl, logger);
132
124
  const aztecNode = createAztecNodeClient(nodeUrl);
133
- const wallet = new TestWallet(pxe, aztecNode);
125
+ const wallet = await TestWallet.create(aztecNode);
134
126
 
135
127
  const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
136
128
  const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
@@ -293,20 +285,20 @@ export async function createWalletAndAztecNodeClient(
293
285
  ): Promise<{ wallet: TestWallet; aztecNode: AztecNode; cleanup: () => Promise<void> }> {
294
286
  const aztecNode = createAztecNodeClient(nodeUrl);
295
287
  const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
296
- const pxe = await createPXEService(aztecNode, {
288
+ const pxeConfig = {
297
289
  dataDirectory: undefined,
298
290
  dataStoreMapSizeKB: 1024 * 1024,
299
291
  ...bbConfig,
300
292
  ...acvmConfig,
301
293
  proverEnabled,
302
- });
303
- const wallet = new TestWallet(pxe, aztecNode);
294
+ };
295
+ const wallet = await TestWallet.create(aztecNode, pxeConfig);
304
296
 
305
297
  return {
306
298
  wallet,
307
299
  aztecNode,
308
300
  async cleanup() {
309
- await pxe.stop();
301
+ await wallet.stop();
310
302
  await bbConfig?.cleanup();
311
303
  await acvmConfig?.cleanup();
312
304
  },