@aztec/end-to-end 2.1.0-rc.9 → 3.0.0-devnet.2

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 (135) 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 +3 -1
  19. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.js +10 -9
  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 +23 -31
  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_nested_contract/nested_contract_test.d.ts +6 -3
  31. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  32. package/dest/e2e_nested_contract/nested_contract_test.js +7 -9
  33. package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
  34. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  35. package/dest/e2e_p2p/inactivity_slash_test.js +5 -2
  36. package/dest/e2e_p2p/p2p_network.d.ts +16 -4
  37. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  38. package/dest/e2e_p2p/p2p_network.js +32 -10
  39. package/dest/e2e_p2p/shared.d.ts +11 -13
  40. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  41. package/dest/e2e_p2p/shared.js +49 -45
  42. package/dest/e2e_token_contract/token_contract_test.d.ts +5 -4
  43. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  44. package/dest/e2e_token_contract/token_contract_test.js +14 -17
  45. package/dest/fixtures/e2e_prover_test.d.ts +8 -6
  46. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  47. package/dest/fixtures/e2e_prover_test.js +40 -50
  48. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  49. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  50. package/dest/fixtures/get_bb_config.d.ts +1 -1
  51. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  52. package/dest/fixtures/get_bb_config.js +2 -2
  53. package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
  54. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  55. package/dest/fixtures/setup_l1_contracts.js +2 -2
  56. package/dest/fixtures/setup_p2p_test.d.ts +0 -7
  57. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  58. package/dest/fixtures/snapshot_manager.d.ts +10 -7
  59. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  60. package/dest/fixtures/snapshot_manager.js +44 -34
  61. package/dest/fixtures/token_utils.d.ts +6 -4
  62. package/dest/fixtures/token_utils.d.ts.map +1 -1
  63. package/dest/fixtures/token_utils.js +11 -15
  64. package/dest/fixtures/utils.d.ts +23 -27
  65. package/dest/fixtures/utils.d.ts.map +1 -1
  66. package/dest/fixtures/utils.js +76 -101
  67. package/dest/fixtures/web3signer.d.ts +1 -1
  68. package/dest/fixtures/web3signer.d.ts.map +1 -1
  69. package/dest/fixtures/web3signer.js +16 -5
  70. package/dest/quality_of_service/alert_checker.d.ts +1 -1
  71. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  72. package/dest/shared/cross_chain_test_harness.d.ts +16 -10
  73. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  74. package/dest/shared/cross_chain_test_harness.js +13 -15
  75. package/dest/shared/gas_portal_test_harness.d.ts +9 -6
  76. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  77. package/dest/shared/gas_portal_test_harness.js +10 -7
  78. package/dest/shared/jest_setup.js +1 -1
  79. package/dest/shared/submit-transactions.d.ts +5 -3
  80. package/dest/shared/submit-transactions.d.ts.map +1 -1
  81. package/dest/shared/submit-transactions.js +8 -7
  82. package/dest/shared/uniswap_l1_l2.d.ts +9 -6
  83. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  84. package/dest/shared/uniswap_l1_l2.js +29 -45
  85. package/dest/simulators/lending_simulator.d.ts +2 -1
  86. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  87. package/dest/simulators/lending_simulator.js +3 -2
  88. package/dest/simulators/token_simulator.d.ts +3 -1
  89. package/dest/simulators/token_simulator.d.ts.map +1 -1
  90. package/dest/simulators/token_simulator.js +2 -2
  91. package/dest/spartan/setup_test_wallets.d.ts +19 -13
  92. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  93. package/dest/spartan/setup_test_wallets.js +108 -85
  94. package/dest/spartan/utils.d.ts +44 -0
  95. package/dest/spartan/utils.d.ts.map +1 -1
  96. package/dest/spartan/utils.js +212 -20
  97. package/package.json +38 -37
  98. package/src/bench/client_flows/benchmark.ts +6 -6
  99. package/src/bench/client_flows/client_flows_benchmark.ts +62 -82
  100. package/src/bench/client_flows/data_extractor.ts +1 -1
  101. package/src/bench/utils.ts +9 -37
  102. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
  103. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +33 -47
  104. package/src/e2e_deploy_contract/deploy_test.ts +17 -35
  105. package/src/e2e_epochs/epochs_test.ts +12 -14
  106. package/src/e2e_fees/bridging_race.notest.ts +14 -9
  107. package/src/e2e_fees/fees_test.ts +26 -38
  108. package/src/e2e_l1_publisher/write_json.ts +8 -6
  109. package/src/e2e_multi_validator/utils.ts +1 -1
  110. package/src/e2e_nested_contract/nested_contract_test.ts +11 -10
  111. package/src/e2e_p2p/inactivity_slash_test.ts +7 -3
  112. package/src/e2e_p2p/p2p_network.ts +105 -67
  113. package/src/e2e_p2p/shared.ts +50 -55
  114. package/src/e2e_token_contract/token_contract_test.ts +17 -17
  115. package/src/fixtures/e2e_prover_test.ts +51 -88
  116. package/src/fixtures/get_acvm_config.ts +1 -1
  117. package/src/fixtures/get_bb_config.ts +3 -2
  118. package/src/fixtures/setup_l1_contracts.ts +3 -3
  119. package/src/fixtures/setup_p2p_test.ts +0 -8
  120. package/src/fixtures/snapshot_manager.ts +61 -61
  121. package/src/fixtures/token_utils.ts +13 -21
  122. package/src/fixtures/utils.ts +87 -138
  123. package/src/fixtures/web3signer.ts +22 -5
  124. package/src/guides/up_quick_start.sh +2 -10
  125. package/src/quality_of_service/alert_checker.ts +1 -1
  126. package/src/shared/cross_chain_test_harness.ts +18 -29
  127. package/src/shared/gas_portal_test_harness.ts +12 -19
  128. package/src/shared/jest_setup.ts +1 -1
  129. package/src/shared/submit-transactions.ts +12 -8
  130. package/src/shared/uniswap_l1_l2.ts +61 -67
  131. package/src/simulators/lending_simulator.ts +3 -2
  132. package/src/simulators/token_simulator.ts +5 -2
  133. package/src/spartan/DEVELOP.md +8 -3
  134. package/src/spartan/setup_test_wallets.ts +133 -126
  135. package/src/spartan/utils.ts +268 -18
@@ -1,9 +1,11 @@
1
1
  import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
- import { deployFundedSchnorrAccounts, generateSchnorrAccounts, getDeployedTestAccounts, getDeployedTestAccountsWallets } from '@aztec/accounts/testing';
2
+ import { generateSchnorrAccounts, getInitialTestAccountsData } from '@aztec/accounts/testing';
3
3
  import { createArchiver } from '@aztec/archiver';
4
4
  import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
5
- import { BatchCall, createAztecNodeClient, createLogger, createPXEClient, makeFetch, sleep, waitForPXE } from '@aztec/aztec.js';
5
+ import { BatchCall } from '@aztec/aztec.js/contracts';
6
6
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
7
+ import { createLogger } from '@aztec/aztec.js/log';
8
+ import { createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
7
9
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
8
10
  import { createBlobSinkClient } from '@aztec/blob-sink/client';
9
11
  import { createBlobSinkServer } from '@aztec/blob-sink/server';
@@ -17,19 +19,19 @@ import { Fr } from '@aztec/foundation/fields';
17
19
  import { tryRmDir } from '@aztec/foundation/fs';
18
20
  import { withLogNameSuffix } from '@aztec/foundation/log';
19
21
  import { retryUntil } from '@aztec/foundation/retry';
20
- import { TestDateProvider } from '@aztec/foundation/timer';
22
+ import { sleep } from '@aztec/foundation/sleep';
23
+ import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
21
24
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
22
25
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
23
26
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
24
- import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
27
+ import { protocolContractsHash } from '@aztec/protocol-contracts';
25
28
  import { createProverNode } from '@aztec/prover-node';
26
- import { createPXEServiceWithSimulator, getPXEServiceConfig } from '@aztec/pxe/server';
27
- import { MemoryCircuitRecorder, SimulatorRecorderWrapper, WASMSimulator } from '@aztec/simulator/client';
28
- import { FileCircuitRecorder } from '@aztec/simulator/testing';
29
+ import { getPXEConfig } from '@aztec/pxe/server';
29
30
  import { getContractClassFromArtifact, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
30
31
  import { tryStop } from '@aztec/stdlib/interfaces/server';
31
32
  import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
32
33
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
34
+ import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
33
35
  import { getGenesisValues } from '@aztec/world-state/testing';
34
36
  import fs from 'fs/promises';
35
37
  import getPort from 'get-port';
@@ -44,8 +46,8 @@ import { getBBConfig } from './get_bb_config.js';
44
46
  import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
45
47
  export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
46
48
  export { startAnvil };
47
- const { PXE_URL = '' } = process.env;
48
- const getAztecUrl = ()=>PXE_URL;
49
+ const { AZTEC_NODE_URL = '' } = process.env;
50
+ const getAztecUrl = ()=>AZTEC_NODE_URL;
49
51
  let telemetry = undefined;
50
52
  function getTelemetryClient(partialConfig = {}) {
51
53
  if (!telemetry) {
@@ -72,7 +74,7 @@ export const getPrivateKeyFromIndex = (index)=>{
72
74
  export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, chain = foundry)=>{
73
75
  const l1Data = await deployL1Contracts(l1RpcUrls, account, chain, logger, {
74
76
  vkTreeRoot: getVKTreeRoot(),
75
- protocolContractTreeRoot,
77
+ protocolContractsHash,
76
78
  genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
77
79
  salt: args.salt,
78
80
  initialValidators: args.initialValidators,
@@ -83,33 +85,30 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
83
85
  return l1Data;
84
86
  };
85
87
  /**
86
- * Sets up Private eXecution Environment (PXE).
88
+ * Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
87
89
  * @param aztecNode - An instance of Aztec Node.
88
- * @param opts - Partial configuration for the PXE service.
90
+ * @param opts - Partial configuration for the PXE.
89
91
  * @param logger - The logger to be used.
90
92
  * @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
91
- * @returns Private eXecution Environment (PXE), logger and teardown function.
92
- */ export async function setupPXEService(aztecNode, opts = {}, logger = getLogger(), useLogSuffix = false) {
93
- const pxeServiceConfig = {
94
- ...getPXEServiceConfig(),
93
+ * @returns A test wallet, logger and teardown function.
94
+ */ export async function setupPXEAndGetWallet(aztecNode, opts = {}, logger = getLogger(), useLogSuffix = false) {
95
+ const PXEConfig = {
96
+ ...getPXEConfig(),
95
97
  ...opts
96
98
  };
97
99
  // For tests we only want proving enabled if specifically requested
98
- pxeServiceConfig.proverEnabled = !!opts.proverEnabled;
100
+ PXEConfig.proverEnabled = !!opts.proverEnabled;
99
101
  // If no data directory provided, create a temp directory and clean up afterwards
100
- const configuredDataDirectory = pxeServiceConfig.dataDirectory;
102
+ const configuredDataDirectory = PXEConfig.dataDirectory;
101
103
  if (!configuredDataDirectory) {
102
- pxeServiceConfig.dataDirectory = path.join(tmpdir(), randomBytes(8).toString('hex'));
104
+ PXEConfig.dataDirectory = path.join(tmpdir(), randomBytes(8).toString('hex'));
103
105
  }
104
- const simulator = new WASMSimulator();
105
- const recorder = process.env.CIRCUIT_RECORD_DIR ? new FileCircuitRecorder(process.env.CIRCUIT_RECORD_DIR) : new MemoryCircuitRecorder();
106
- const simulatorWithRecorder = new SimulatorRecorderWrapper(simulator, recorder);
107
- const pxe = await createPXEServiceWithSimulator(aztecNode, simulatorWithRecorder, pxeServiceConfig, {
106
+ const teardown = configuredDataDirectory ? ()=>Promise.resolve() : ()=>tryRmDir(PXEConfig.dataDirectory);
107
+ const wallet = await TestWallet.create(aztecNode, PXEConfig, {
108
108
  useLogSuffix
109
109
  });
110
- const teardown = configuredDataDirectory ? ()=>Promise.resolve() : ()=>tryRmDir(pxeServiceConfig.dataDirectory);
111
110
  return {
112
- pxe,
111
+ wallet,
113
112
  logger,
114
113
  teardown
115
114
  };
@@ -127,44 +126,40 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
127
126
  const aztecNodeUrl = getAztecUrl();
128
127
  logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
129
128
  const aztecNode = createAztecNodeClient(aztecNodeUrl);
130
- logger.verbose(`Creating PXE client to remote host ${PXE_URL}`);
131
- const pxeClient = createPXEClient(PXE_URL, {}, makeFetch([
132
- 1,
133
- 2,
134
- 3
135
- ], true));
136
- await waitForPXE(pxeClient, logger);
137
- logger.verbose('JSON RPC client connected to PXE');
138
- logger.verbose(`Retrieving contract addresses from ${PXE_URL}`);
139
- const { l1ContractAddresses, rollupVersion } = await pxeClient.getNodeInfo();
129
+ await waitForNode(aztecNode, logger);
130
+ logger.verbose('JSON RPC client connected to Aztec Node');
131
+ logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
132
+ const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
140
133
  const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
141
134
  const deployL1ContractsValues = {
142
135
  l1ContractAddresses,
143
136
  l1Client,
144
137
  rollupVersion
145
138
  };
146
- const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls);
147
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient);
139
+ const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
140
+ const wallet = await TestWallet.create(aztecNode);
141
+ const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
148
142
  const teardown = ()=>Promise.resolve();
149
- logger.verbose('Constructing available wallets from already registered accounts...');
150
- const initialFundedAccounts = await getDeployedTestAccounts(pxeClient);
151
- const wallets = await getDeployedTestAccountsWallets(pxeClient);
152
- if (wallets.length < numberOfAccounts) {
153
- throw new Error(`Required ${numberOfAccounts} accounts. Found ${wallets.length}.`);
143
+ logger.verbose('Populating wallet from already registered accounts...');
144
+ const initialFundedAccounts = await getInitialTestAccountsData();
145
+ if (initialFundedAccounts.length < numberOfAccounts) {
146
+ throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
154
147
  // Deploy new accounts if there's a test that requires more funded accounts in the remote environment.
155
148
  }
149
+ const testAccounts = await Promise.all(initialFundedAccounts.slice(0, numberOfAccounts).map(async (account)=>{
150
+ const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
151
+ return accountManager.address;
152
+ }));
156
153
  return {
157
154
  aztecNode,
158
155
  aztecNodeAdmin: undefined,
159
156
  sequencer: undefined,
160
157
  proverNode: undefined,
161
- pxe: pxeClient,
162
158
  deployL1ContractsValues,
163
159
  config,
164
160
  initialFundedAccounts,
165
- wallets,
166
- wallet: wallets[0],
167
- accounts: wallets.slice(0, numberOfAccounts).map((w)=>w.getAddress()),
161
+ wallet,
162
+ accounts: testAccounts,
168
163
  logger,
169
164
  cheatCodes,
170
165
  ethCheatCodes,
@@ -211,8 +206,8 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
211
206
  if (!isAnvilTestChain(chain.id)) {
212
207
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
213
208
  }
214
- if (PXE_URL) {
215
- throw new Error(`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`);
209
+ if (AZTEC_NODE_URL) {
210
+ throw new Error(`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`);
216
211
  }
217
212
  const res = await startAnvil({
218
213
  l1BlockTime: opts.ethereumSlotDuration,
@@ -230,7 +225,8 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
230
225
  logger.info(`Logging metrics to ${filename}`);
231
226
  setupMetricsLogger(filename);
232
227
  }
233
- const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls);
228
+ const dateProvider = new TestDateProvider();
229
+ const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
234
230
  if (opts.stateLoad) {
235
231
  await ethCheatCodes.loadChainState(opts.stateLoad);
236
232
  }
@@ -258,7 +254,7 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
258
254
  ];
259
255
  }
260
256
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
261
- if (PXE_URL) {
257
+ if (AZTEC_NODE_URL) {
262
258
  // we are setting up against a remote environment, l1 contracts are assumed to already be deployed
263
259
  return await setupWithRemoteEnvironment(publisherHdAccount, config, logger, numberOfAccounts);
264
260
  }
@@ -301,6 +297,7 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
301
297
  if (enableAutomine) {
302
298
  await ethCheatCodes.setAutomine(false);
303
299
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
300
+ dateProvider.setTime(await ethCheatCodes.timestamp() * 1000);
304
301
  }
305
302
  if (opts.l2StartTime) {
306
303
  // This should only be used in synching test or when you need to have a stable
@@ -309,9 +306,7 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
309
306
  resetBlockInterval: true
310
307
  });
311
308
  }
312
- const dateProvider = new TestDateProvider();
313
- dateProvider.setTime(await ethCheatCodes.timestamp() * 1000);
314
- const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider);
309
+ const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls, dateProvider), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider);
315
310
  if (!opts.disableAnvilTestWatcher) {
316
311
  await watcher.start();
317
312
  }
@@ -324,7 +319,7 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
324
319
  l1Contracts: config.l1Contracts,
325
320
  port: blobSinkPort,
326
321
  dataDirectory: config.dataDirectory,
327
- dataStoreMapSizeKB: config.dataStoreMapSizeKB
322
+ dataStoreMapSizeKb: config.dataStoreMapSizeKb
328
323
  }, telemetry);
329
324
  await blobSink.start();
330
325
  config.blobSinkUrl = `http://localhost:${blobSinkPort}`;
@@ -404,32 +399,31 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
404
399
  proverNode = await createAndSyncProverNode(proverNodePrivateKeyHex, config, proverNodeConfig, aztecNode, prefilledPublicData);
405
400
  }
406
401
  logger.verbose('Creating a pxe...');
407
- const { pxe, teardown: pxeTeardown } = await setupPXEService(aztecNode, pxeOpts, logger);
408
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe);
402
+ const { wallet, teardown: pxeTeardown } = await setupPXEAndGetWallet(aztecNode, pxeOpts, logger);
403
+ const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, dateProvider);
409
404
  if (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0 || opts.initialValidators && opts.initialValidators.length > 0) {
410
405
  // We need to advance such that the committee is set up.
411
- await cheatCodes.rollup.advanceToEpoch(await cheatCodes.rollup.getEpoch() + BigInt(config.lagInEpochs + 1), {
412
- updateDateProvider: dateProvider
413
- });
406
+ await cheatCodes.rollup.advanceToEpoch(await cheatCodes.rollup.getEpoch() + BigInt(config.lagInEpochs + 1));
414
407
  await cheatCodes.rollup.setupEpoch();
415
408
  await cheatCodes.rollup.debugRollup();
416
409
  }
410
+ let accounts = [];
417
411
  // Below we continue with what we described in the long comment on line 571.
418
- let accountManagers = [];
419
412
  if (numberOfAccounts === 0) {
420
413
  logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
421
- while(await pxe.getBlockNumber() === 0){
414
+ while(await aztecNode.getBlockNumber() === 0){
422
415
  await sleep(2000);
423
416
  }
424
417
  } else {
425
418
  logger.info(`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`);
426
- accountManagers = await deployFundedSchnorrAccounts(pxe, initialFundedAccounts.slice(0, numberOfAccounts));
419
+ const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
420
+ const accountManagers = await deployFundedSchnorrAccounts(wallet, aztecNode, accountsData);
421
+ accounts = accountManagers.map((accountManager)=>accountManager.address);
427
422
  }
428
423
  // Now we restore the original minTxsPerBlock setting.
429
424
  sequencerClient.getSequencer().updateConfig({
430
425
  minTxsPerBlock: originalMinTxsPerBlock
431
426
  });
432
- const wallets = await Promise.all(accountManagers.map((account)=>account.getWallet()));
433
427
  if (initialFundedAccounts.length < numberOfAccounts) {
434
428
  // TODO: Create (numberOfAccounts - initialFundedAccounts.length) wallets without funds.
435
429
  throw new Error(`Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`);
@@ -467,13 +461,11 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
467
461
  mockGossipSubNetwork,
468
462
  prefilledPublicData,
469
463
  proverNode,
470
- pxe,
471
464
  sequencer: sequencerClient,
472
465
  teardown,
473
466
  telemetryClient: telemetry,
474
- wallets,
475
- wallet: wallets[0],
476
- accounts: wallets.map((w)=>w.getAddress()),
467
+ wallet,
468
+ accounts,
477
469
  watcher
478
470
  };
479
471
  } catch (err) {
@@ -487,45 +479,28 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
487
479
  * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
488
480
  * @param sender - Wallet to send the deployment tx.
489
481
  * @param accountsToDeploy - Which accounts to publicly deploy.
490
- */ // docs:start:public_deploy_accounts
491
- export async function ensureAccountContractsPublished(sender, accountsToDeploy) {
482
+ */ export async function ensureAccountContractsPublished(wallet, accountsToDeploy) {
492
483
  // We have to check whether the accounts are already deployed. This can happen if the test runs against
493
484
  // the sandbox and the test accounts exist
494
- const accountsAndAddresses = await Promise.all(accountsToDeploy.map(async (account)=>{
495
- const address = account.getAddress();
485
+ const accountsAndAddresses = await Promise.all(accountsToDeploy.map(async (address)=>{
496
486
  return {
497
487
  address,
498
- deployed: (await sender.getContractMetadata(address)).isContractPublished
488
+ deployed: (await wallet.getContractMetadata(address)).isContractPublished
499
489
  };
500
490
  }));
501
- const instances = (await Promise.all(accountsAndAddresses.filter(({ deployed })=>!deployed).map(({ address })=>sender.getContractMetadata(address)))).map((contractMetadata)=>contractMetadata.contractInstance);
491
+ const instances = (await Promise.all(accountsAndAddresses.filter(({ deployed })=>!deployed).map(({ address })=>wallet.getContractMetadata(address)))).map((contractMetadata)=>contractMetadata.contractInstance);
502
492
  const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
503
- if (!(await sender.getContractClassMetadata(contractClass.id, true)).isContractClassPubliclyRegistered) {
504
- await (await publishContractClass(sender, SchnorrAccountContractArtifact)).send({
505
- from: accountsToDeploy[0].getAddress()
493
+ if (!(await wallet.getContractClassMetadata(contractClass.id, true)).isContractClassPubliclyRegistered) {
494
+ await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({
495
+ from: accountsToDeploy[0]
506
496
  }).wait();
507
497
  }
508
- const requests = await Promise.all(instances.map(async (instance)=>await publishInstance(sender, instance)));
509
- const batch = new BatchCall(sender, requests);
498
+ const requests = await Promise.all(instances.map(async (instance)=>await publishInstance(wallet, instance)));
499
+ const batch = new BatchCall(wallet, requests);
510
500
  await batch.send({
511
- from: accountsToDeploy[0].getAddress()
501
+ from: accountsToDeploy[0]
512
502
  }).wait();
513
503
  }
514
- // docs:end:public_deploy_accounts
515
- /**
516
- * Sets the timestamp of the next block.
517
- * @param rpcUrl - rpc url of the blockchain instance to connect to
518
- * @param timestamp - the timestamp for the next block
519
- */ export async function setNextBlockTimestamp(rpcUrl, timestamp) {
520
- const params = `[${timestamp}]`;
521
- await fetch(rpcUrl, {
522
- body: `{"jsonrpc":"2.0", "method": "evm_setNextBlockTimestamp", "params": ${params}, "id": 1}`,
523
- method: 'POST',
524
- headers: {
525
- 'Content-Type': 'application/json'
526
- }
527
- });
528
- }
529
504
  /** Returns the job name for the current test. */ function getJobName() {
530
505
  return process.env.JOB_NAME ?? expect.getState().currentTestName?.split(' ')[0].replaceAll('/', '_') ?? 'unknown';
531
506
  }
@@ -564,7 +539,7 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
564
539
  expect(diffs).toEqual(expectedDiffs);
565
540
  }
566
541
  /**
567
- * Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
542
+ * Computes the address of the "canonical" SponsoredFPCContract. This is not a protocol contract
568
543
  * but by conventions its address is computed with a salt of 0.
569
544
  * @returns The address of the sponsored FPC contract
570
545
  */ export function getSponsoredFPCInstance() {
@@ -573,7 +548,7 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
573
548
  }));
574
549
  }
575
550
  /**
576
- * Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
551
+ * Computes the address of the "canonical" SponsoredFPCContract. This is not a protocol contract
577
552
  * but by conventions its address is computed with a salt of 0.
578
553
  * @returns The address of the sponsored FPC contract
579
554
  */ export async function getSponsoredFPCAddress() {
@@ -582,11 +557,11 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
582
557
  }
583
558
  /**
584
559
  * Deploy a sponsored FPC contract to a running instance.
585
- */ export async function setupSponsoredFPC(pxe) {
560
+ */ export async function setupSponsoredFPC(wallet) {
586
561
  const instance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
587
562
  salt: new Fr(SPONSORED_FPC_SALT)
588
563
  });
589
- await pxe.registerContract({
564
+ await wallet.registerContract({
590
565
  instance,
591
566
  artifact: SponsoredFPCContract.artifact
592
567
  });
@@ -595,9 +570,9 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
595
570
  }
596
571
  /**
597
572
  * Registers the SponsoredFPC in this PXE instance
598
- * @param pxe - The pxe client
599
- */ export async function registerSponsoredFPC(pxe) {
600
- await pxe.registerContract({
573
+ * @param wallet - The wallet
574
+ */ export async function registerSponsoredFPC(wallet) {
575
+ await wallet.registerContract({
601
576
  instance: await getSponsoredFPCInstance(),
602
577
  artifact: SponsoredFPCContract.artifact
603
578
  });
@@ -1,5 +1,5 @@
1
1
  export declare function createWeb3SignerKeystore(dir: string, ...privateKeys: string[]): Promise<void>;
2
- export declare function refreshWeb3Signer(url: string): Promise<void>;
2
+ export declare function refreshWeb3Signer(url: string, ...expectedAddresses: string[]): Promise<void>;
3
3
  export declare function getWeb3SignerTestKeystoreDir(): string;
4
4
  export declare function getWeb3SignerUrl(): string;
5
5
  //# sourceMappingURL=web3signer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"web3signer.d.ts","sourceRoot":"","sources":["../../src/fixtures/web3signer.ts"],"names":[],"mappings":"AAOA,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,MAAM,EAAE,iBAcnF;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,iBAKlD;AAED,wBAAgB,4BAA4B,IAAI,MAAM,CAOrD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAMzC"}
1
+ {"version":3,"file":"web3signer.d.ts","sourceRoot":"","sources":["../../src/fixtures/web3signer.ts"],"names":[],"mappings":"AASA,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,MAAM,EAAE,iBAcnF;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,MAAM,EAAE,iBAoBlF;AAED,wBAAgB,4BAA4B,IAAI,MAAM,CAOrD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAMzC"}
@@ -1,5 +1,7 @@
1
- import { sleep } from '@aztec/aztec.js';
2
1
  import { randomBytes } from '@aztec/foundation/crypto';
2
+ import { retryUntil } from '@aztec/foundation/retry';
3
+ import { sleep } from '@aztec/foundation/sleep';
4
+ import { RemoteSigner } from '@aztec/node-keystore';
3
5
  import { mkdirSync } from 'node:fs';
4
6
  import { writeFile } from 'node:fs/promises';
5
7
  import { join } from 'node:path';
@@ -15,13 +17,22 @@ privateKey: ${pk}`).join('\n---\n');
15
17
  flag: 'wx'
16
18
  });
17
19
  }
18
- export async function refreshWeb3Signer(url) {
20
+ export async function refreshWeb3Signer(url, ...expectedAddresses) {
19
21
  await fetch(new URL('reload', url), {
20
22
  method: 'POST'
21
23
  });
22
- // give the service a chance to load up the new files
23
- // 1s might not be enough if there are a lot of files to scan
24
- await sleep(1000);
24
+ if (expectedAddresses.length > 0) {
25
+ await retryUntil(async ()=>{
26
+ try {
27
+ await RemoteSigner.validateAccess(url, expectedAddresses);
28
+ return true;
29
+ } catch {
30
+ return false;
31
+ }
32
+ }, 'web3signer refresh', 10, 0.5);
33
+ } else {
34
+ await sleep(1000);
35
+ }
25
36
  }
26
37
  export function getWeb3SignerTestKeystoreDir() {
27
38
  if (process.env.WEB3_SIGNER_TEST_KEYSTORE_DIR) {
@@ -1,4 +1,4 @@
1
- import type { Logger } from '@aztec/aztec.js';
1
+ import type { Logger } from '@aztec/aztec.js/log';
2
2
  export interface AlertConfig {
3
3
  alert: string;
4
4
  expr: string;
@@ -1 +1 @@
1
- {"version":3,"file":"alert_checker.d.ts","sourceRoot":"","sources":["../../src/quality_of_service/alert_checker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAK9C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAA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AAE,MAAM,CAAC,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAQD,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAKpE;;;OAGG;IACH,OAAO,CAAC,gBAAgB;YAMV,YAAY;YAqCZ,WAAW;IAqBzB;;;OAGG;IACU,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAUhE;;;OAGG;IACU,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIxE;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IACnC,IAAI,SAAyB;CACvC"}
@@ -1,5 +1,15 @@
1
- import { type AccountWallet, AuthWitness, type AztecAddress, type AztecNode, EthAddress, type FieldsOf, Fr, type L2AmountClaim, type L2AmountClaimWithRecipient, type Logger, type PXE, type SiblingPath, type TxReceipt, type Wallet } from '@aztec/aztec.js';
1
+ import type { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import { EthAddress } from '@aztec/aztec.js/addresses';
3
+ import { AuthWitness } from '@aztec/aztec.js/authorization';
4
+ import { type L2AmountClaim, type L2AmountClaimWithRecipient } from '@aztec/aztec.js/ethereum';
5
+ import { Fr } from '@aztec/aztec.js/fields';
6
+ import type { Logger } from '@aztec/aztec.js/log';
7
+ import type { AztecNode } from '@aztec/aztec.js/node';
8
+ import type { SiblingPath } from '@aztec/aztec.js/trees';
9
+ import type { TxReceipt } from '@aztec/aztec.js/tx';
10
+ import type { Wallet } from '@aztec/aztec.js/wallet';
2
11
  import { type ExtendedViemWalletClient, type L1ContractAddresses } from '@aztec/ethereum';
12
+ import type { FieldsOf } from '@aztec/foundation/types';
3
13
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
4
14
  import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
5
15
  import { type Hex } from 'viem';
@@ -52,8 +62,6 @@ export type CrossChainContext = {
52
62
  export declare class CrossChainTestHarness {
53
63
  /** Aztec node instance. */
54
64
  aztecNode: AztecNode;
55
- /** Private eXecution Environment (PXE). */
56
- pxeService: PXE;
57
65
  /** Logger. */
58
66
  logger: Logger;
59
67
  /** L2 Token contract. */
@@ -70,18 +78,16 @@ export declare class CrossChainTestHarness {
70
78
  l1Client: ExtendedViemWalletClient;
71
79
  /** Deployment addresses for all L1 contracts */
72
80
  readonly l1ContractAddresses: L1ContractAddresses;
73
- /** Wallet of the owner. */
74
- readonly ownerWallet: AccountWallet;
81
+ /** Wallet to simulate and send txs from. */
82
+ readonly wallet: Wallet;
75
83
  /** Owner of the l2 token and bridge */
76
84
  readonly ownerAddress: AztecAddress;
77
- static new(aztecNode: AztecNode, pxeService: PXE, l1Client: ExtendedViemWalletClient, wallet: AccountWallet, ownerAddress: AztecAddress, logger: Logger, underlyingERC20Address: EthAddress): Promise<CrossChainTestHarness>;
85
+ static new(aztecNode: AztecNode, l1Client: ExtendedViemWalletClient, wallet: Wallet, ownerAddress: AztecAddress, logger: Logger, underlyingERC20Address: EthAddress): Promise<CrossChainTestHarness>;
78
86
  private readonly l1TokenManager;
79
87
  private readonly l1TokenPortalManager;
80
88
  constructor(
81
89
  /** Aztec node instance. */
82
90
  aztecNode: AztecNode,
83
- /** Private eXecution Environment (PXE). */
84
- pxeService: PXE,
85
91
  /** Logger. */
86
92
  logger: Logger,
87
93
  /** L2 Token contract. */
@@ -98,8 +104,8 @@ export declare class CrossChainTestHarness {
98
104
  l1Client: ExtendedViemWalletClient,
99
105
  /** Deployment addresses for all L1 contracts */
100
106
  l1ContractAddresses: L1ContractAddresses,
101
- /** Wallet of the owner. */
102
- ownerWallet: AccountWallet,
107
+ /** Wallet to simulate and send txs from. */
108
+ wallet: Wallet,
103
109
  /** Owner of the l2 token and bridge */
104
110
  ownerAddress: AztecAddress);
105
111
  mintTokensOnL1(amount: bigint): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"cross_chain_test_harness.d.ts","sourceRoot":"","sources":["../../src/shared/cross_chain_test_harness.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,UAAU,EACV,KAAK,QAAQ,EACb,EAAE,EAGF,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAC/B,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,MAAM,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,mBAAmB,EAAoB,MAAM,iBAAiB,CAAC;AAE5G,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EAAE,KAAK,GAAG,EAAe,MAAM,MAAM,CAAC;AAK7C;;;;;;;;;GASG;AACH,wBAAsB,0CAA0C,CAC9D,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,wBAAwB,EAClC,qBAAqB,EAAE,UAAU,EACjC,KAAK,EAAE,YAAY,EACnB,sBAAsB,EAAE,UAAU,GACjC,OAAO,CAAC;IACT;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IACrB;;OAEG;IACH,MAAM,EAAE,mBAAmB,CAAC;IAC5B;;OAEG;IACH,kBAAkB,EAAE,UAAU,CAAC;IAC/B;;OAEG;IACH,WAAW,EAAE,GAAG,CAAC;IACjB;;OAEG;IACH,eAAe,EAAE,GAAG,CAAC;CACtB,CAAC,CA8CD;AAGD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAA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harness
2
- import { EthAddress, Fr, L1TokenPortalManager, retryUntil } from '@aztec/aztec.js';
1
+ import { EthAddress } from '@aztec/aztec.js/addresses';
2
+ import { L1TokenPortalManager } from '@aztec/aztec.js/ethereum';
3
+ import { Fr } from '@aztec/aztec.js/fields';
3
4
  import { deployL1Contract } from '@aztec/ethereum';
5
+ import { retryUntil } from '@aztec/foundation/retry';
4
6
  import { TestERC20Abi, TokenPortalAbi, TokenPortalBytecode } from '@aztec/l1-artifacts';
5
7
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
6
8
  import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
7
9
  import { getContract } from 'viem';
8
10
  import { mintTokensToPrivate } from '../fixtures/token_utils.js';
9
- // docs:start:deployAndInitializeTokenAndBridgeContracts
10
11
  /**
11
12
  * Deploy L1 token and portal, initialize portal, deploy a non native l2 token contract, its L2 bridge contract and attach is to the portal.
12
13
  * @param wallet - the wallet instance
@@ -75,7 +76,6 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
75
76
  * shared between cross chain tests.
76
77
  */ export class CrossChainTestHarness {
77
78
  aztecNode;
78
- pxeService;
79
79
  logger;
80
80
  l2Token;
81
81
  l2Bridge;
@@ -84,22 +84,21 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
84
84
  underlyingERC20Address;
85
85
  l1Client;
86
86
  l1ContractAddresses;
87
- ownerWallet;
87
+ wallet;
88
88
  ownerAddress;
89
- static async new(aztecNode, pxeService, l1Client, wallet, ownerAddress, logger, underlyingERC20Address) {
89
+ static async new(aztecNode, l1Client, wallet, ownerAddress, logger, underlyingERC20Address) {
90
90
  const ethAccount = EthAddress.fromString((await l1Client.getAddresses())[0]);
91
- const l1ContractAddresses = (await pxeService.getNodeInfo()).l1ContractAddresses;
91
+ const l1ContractAddresses = (await aztecNode.getNodeInfo()).l1ContractAddresses;
92
92
  // Deploy and initialize all required contracts
93
93
  logger.info('Deploying and initializing token, portal and its bridge...');
94
- const { token, bridge, tokenPortalAddress, underlyingERC20 } = await deployAndInitializeTokenAndBridgeContracts(wallet, l1Client, l1ContractAddresses.registryAddress, wallet.getAddress(), underlyingERC20Address);
94
+ const { token, bridge, tokenPortalAddress, underlyingERC20 } = await deployAndInitializeTokenAndBridgeContracts(wallet, l1Client, l1ContractAddresses.registryAddress, ownerAddress, underlyingERC20Address);
95
95
  logger.info('Deployed and initialized token, portal and its bridge.');
96
- return new CrossChainTestHarness(aztecNode, pxeService, logger, token, bridge, ethAccount, tokenPortalAddress, underlyingERC20.address, l1Client, l1ContractAddresses, wallet, ownerAddress);
96
+ return new CrossChainTestHarness(aztecNode, logger, token, bridge, ethAccount, tokenPortalAddress, underlyingERC20.address, l1Client, l1ContractAddresses, wallet, ownerAddress);
97
97
  }
98
98
  l1TokenManager;
99
99
  l1TokenPortalManager;
100
- constructor(/** Aztec node instance. */ aztecNode, /** Private eXecution Environment (PXE). */ pxeService, /** Logger. */ logger, /** L2 Token contract. */ l2Token, /** L2 Token bridge contract. */ l2Bridge, /** Eth account to interact with. */ ethAccount, /** Portal address. */ tokenPortalAddress, /** Underlying token for portal tests. */ underlyingERC20Address, /** Viem Extended client instance. */ l1Client, /** Deployment addresses for all L1 contracts */ l1ContractAddresses, /** Wallet of the owner. */ ownerWallet, /** Owner of the l2 token and bridge */ ownerAddress){
100
+ constructor(/** Aztec node instance. */ aztecNode, /** Logger. */ logger, /** L2 Token contract. */ l2Token, /** L2 Token bridge contract. */ l2Bridge, /** Eth account to interact with. */ ethAccount, /** Portal address. */ tokenPortalAddress, /** Underlying token for portal tests. */ underlyingERC20Address, /** Viem Extended client instance. */ l1Client, /** Deployment addresses for all L1 contracts */ l1ContractAddresses, /** Wallet to simulate and send txs from. */ wallet, /** Owner of the l2 token and bridge */ ownerAddress){
101
101
  this.aztecNode = aztecNode;
102
- this.pxeService = pxeService;
103
102
  this.logger = logger;
104
103
  this.l2Token = l2Token;
105
104
  this.l2Bridge = l2Bridge;
@@ -108,11 +107,10 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
108
107
  this.underlyingERC20Address = underlyingERC20Address;
109
108
  this.l1Client = l1Client;
110
109
  this.l1ContractAddresses = l1ContractAddresses;
111
- this.ownerWallet = ownerWallet;
110
+ this.wallet = wallet;
112
111
  this.ownerAddress = ownerAddress;
113
112
  this.l1TokenPortalManager = new L1TokenPortalManager(this.tokenPortalAddress, this.underlyingERC20Address, this.l1ContractAddresses.feeAssetHandlerAddress, this.l1ContractAddresses.outboxAddress, this.l1Client, this.logger);
114
113
  this.l1TokenManager = this.l1TokenPortalManager.getTokenManager();
115
- this.ownerAddress = this.ownerWallet.getAddress();
116
114
  }
117
115
  async mintTokensOnL1(amount) {
118
116
  const contract = getContract({
@@ -146,7 +144,7 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
146
144
  }).wait();
147
145
  }
148
146
  async mintTokensPrivateOnL2(amount) {
149
- await mintTokensToPrivate(this.l2Token, this.ownerAddress, this.ownerWallet, this.ownerAddress, amount);
147
+ await mintTokensToPrivate(this.l2Token, this.ownerAddress, this.ownerAddress, amount);
150
148
  }
151
149
  async sendL2PublicTransfer(transferAmount, receiverAddress) {
152
150
  // send a transfer tx to force through rollup with the message included
@@ -245,4 +243,4 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
245
243
  outbox: this.l1ContractAddresses.outboxAddress
246
244
  };
247
245
  }
248
- } // docs:end:cross_chain_test_harness
246
+ }