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

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 (165) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +4 -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 +25 -14
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  6. package/dest/bench/client_flows/client_flows_benchmark.js +111 -90
  7. package/dest/bench/client_flows/config.d.ts +1 -1
  8. package/dest/bench/client_flows/data_extractor.d.ts +1 -1
  9. package/dest/bench/client_flows/data_extractor.js +8 -30
  10. package/dest/bench/utils.d.ts +4 -13
  11. package/dest/bench/utils.d.ts.map +1 -1
  12. package/dest/bench/utils.js +10 -34
  13. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +8 -8
  14. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  15. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +42 -42
  16. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +12 -9
  17. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  18. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +35 -35
  19. package/dest/e2e_deploy_contract/deploy_test.d.ts +12 -6
  20. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  21. package/dest/e2e_deploy_contract/deploy_test.js +9 -18
  22. package/dest/e2e_epochs/epochs_test.d.ts +19 -12
  23. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  24. package/dest/e2e_epochs/epochs_test.js +30 -22
  25. package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
  26. package/dest/e2e_fees/bridging_race.notest.js +14 -11
  27. package/dest/e2e_fees/fees_test.d.ts +10 -8
  28. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  29. package/dest/e2e_fees/fees_test.js +35 -38
  30. package/dest/e2e_l1_publisher/write_json.d.ts +4 -2
  31. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  32. package/dest/e2e_l1_publisher/write_json.js +9 -8
  33. package/dest/e2e_multi_validator/utils.d.ts +2 -2
  34. package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
  35. package/dest/e2e_multi_validator/utils.js +4 -10
  36. package/dest/e2e_nested_contract/nested_contract_test.d.ts +7 -4
  37. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  38. package/dest/e2e_nested_contract/nested_contract_test.js +11 -12
  39. package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
  40. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
  41. package/dest/e2e_p2p/inactivity_slash_test.js +139 -0
  42. package/dest/e2e_p2p/p2p_network.d.ts +238 -17
  43. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  44. package/dest/e2e_p2p/p2p_network.js +46 -19
  45. package/dest/e2e_p2p/shared.d.ts +16 -17
  46. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  47. package/dest/e2e_p2p/shared.js +56 -55
  48. package/dest/e2e_token_contract/token_contract_test.d.ts +6 -5
  49. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  50. package/dest/e2e_token_contract/token_contract_test.js +14 -17
  51. package/dest/fixtures/e2e_prover_test.d.ts +12 -8
  52. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  53. package/dest/fixtures/e2e_prover_test.js +53 -58
  54. package/dest/fixtures/fixtures.d.ts +1 -1
  55. package/dest/fixtures/fixtures.d.ts.map +1 -1
  56. package/dest/fixtures/fixtures.js +1 -1
  57. package/dest/fixtures/get_acvm_config.d.ts +2 -2
  58. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  59. package/dest/fixtures/get_acvm_config.js +1 -1
  60. package/dest/fixtures/get_bb_config.d.ts +2 -2
  61. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  62. package/dest/fixtures/get_bb_config.js +2 -2
  63. package/dest/fixtures/index.d.ts +1 -1
  64. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  65. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  66. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  67. package/dest/fixtures/logging.d.ts +1 -1
  68. package/dest/fixtures/setup_l1_contracts.d.ts +476 -5
  69. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  70. package/dest/fixtures/setup_l1_contracts.js +3 -3
  71. package/dest/fixtures/setup_p2p_test.d.ts +12 -11
  72. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  73. package/dest/fixtures/setup_p2p_test.js +50 -24
  74. package/dest/fixtures/snapshot_manager.d.ts +13 -10
  75. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  76. package/dest/fixtures/snapshot_manager.js +66 -51
  77. package/dest/fixtures/token_utils.d.ts +10 -5
  78. package/dest/fixtures/token_utils.d.ts.map +1 -1
  79. package/dest/fixtures/token_utils.js +17 -18
  80. package/dest/fixtures/utils.d.ts +479 -35
  81. package/dest/fixtures/utils.d.ts.map +1 -1
  82. package/dest/fixtures/utils.js +106 -125
  83. package/dest/fixtures/web3signer.d.ts +5 -0
  84. package/dest/fixtures/web3signer.d.ts.map +1 -0
  85. package/dest/fixtures/web3signer.js +53 -0
  86. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  87. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  88. package/dest/fixtures/with_telemetry_utils.js +2 -2
  89. package/dest/index.d.ts +1 -1
  90. package/dest/quality_of_service/alert_checker.d.ts +2 -2
  91. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  92. package/dest/shared/cross_chain_test_harness.d.ts +20 -23
  93. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  94. package/dest/shared/cross_chain_test_harness.js +14 -16
  95. package/dest/shared/gas_portal_test_harness.d.ts +10 -17
  96. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  97. package/dest/shared/gas_portal_test_harness.js +11 -8
  98. package/dest/shared/index.d.ts +1 -1
  99. package/dest/shared/jest_setup.d.ts +1 -1
  100. package/dest/shared/jest_setup.js +1 -1
  101. package/dest/shared/submit-transactions.d.ts +6 -4
  102. package/dest/shared/submit-transactions.d.ts.map +1 -1
  103. package/dest/shared/submit-transactions.js +8 -7
  104. package/dest/shared/uniswap_l1_l2.d.ts +12 -8
  105. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  106. package/dest/shared/uniswap_l1_l2.js +44 -58
  107. package/dest/simulators/index.d.ts +1 -1
  108. package/dest/simulators/lending_simulator.d.ts +4 -7
  109. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  110. package/dest/simulators/lending_simulator.js +8 -5
  111. package/dest/simulators/token_simulator.d.ts +4 -2
  112. package/dest/simulators/token_simulator.d.ts.map +1 -1
  113. package/dest/simulators/token_simulator.js +2 -2
  114. package/dest/spartan/setup_test_wallets.d.ts +22 -14
  115. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  116. package/dest/spartan/setup_test_wallets.js +144 -86
  117. package/dest/spartan/tx_metrics.d.ts +39 -0
  118. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  119. package/dest/spartan/tx_metrics.js +95 -0
  120. package/dest/spartan/utils.d.ts +92 -17
  121. package/dest/spartan/utils.d.ts.map +1 -1
  122. package/dest/spartan/utils.js +386 -63
  123. package/package.json +43 -40
  124. package/src/bench/client_flows/benchmark.ts +8 -8
  125. package/src/bench/client_flows/client_flows_benchmark.ts +141 -114
  126. package/src/bench/client_flows/data_extractor.ts +9 -31
  127. package/src/bench/utils.ts +9 -37
  128. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
  129. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +38 -51
  130. package/src/e2e_deploy_contract/deploy_test.ts +18 -36
  131. package/src/e2e_epochs/epochs_test.ts +41 -35
  132. package/src/e2e_fees/bridging_race.notest.ts +16 -11
  133. package/src/e2e_fees/fees_test.ts +42 -47
  134. package/src/e2e_l1_publisher/write_json.ts +12 -9
  135. package/src/e2e_multi_validator/utils.ts +5 -11
  136. package/src/e2e_nested_contract/nested_contract_test.ts +15 -13
  137. package/src/e2e_p2p/inactivity_slash_test.ts +184 -0
  138. package/src/e2e_p2p/p2p_network.ts +124 -82
  139. package/src/e2e_p2p/shared.ts +66 -58
  140. package/src/e2e_token_contract/token_contract_test.ts +17 -17
  141. package/src/fixtures/e2e_prover_test.ts +60 -97
  142. package/src/fixtures/fixtures.ts +1 -2
  143. package/src/fixtures/get_acvm_config.ts +2 -2
  144. package/src/fixtures/get_bb_config.ts +3 -2
  145. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  146. package/src/fixtures/setup_l1_contracts.ts +5 -4
  147. package/src/fixtures/setup_p2p_test.ts +79 -32
  148. package/src/fixtures/snapshot_manager.ts +87 -82
  149. package/src/fixtures/token_utils.ts +16 -24
  150. package/src/fixtures/utils.ts +142 -172
  151. package/src/fixtures/web3signer.ts +63 -0
  152. package/src/fixtures/with_telemetry_utils.ts +2 -2
  153. package/src/guides/up_quick_start.sh +3 -11
  154. package/src/quality_of_service/alert_checker.ts +1 -1
  155. package/src/shared/cross_chain_test_harness.ts +23 -31
  156. package/src/shared/gas_portal_test_harness.ts +14 -21
  157. package/src/shared/jest_setup.ts +1 -1
  158. package/src/shared/submit-transactions.ts +12 -8
  159. package/src/shared/uniswap_l1_l2.ts +77 -86
  160. package/src/simulators/lending_simulator.ts +9 -6
  161. package/src/simulators/token_simulator.ts +5 -2
  162. package/src/spartan/DEVELOP.md +15 -3
  163. package/src/spartan/setup_test_wallets.ts +171 -127
  164. package/src/spartan/tx_metrics.ts +130 -0
  165. package/src/spartan/utils.ts +463 -64
@@ -1,6 +1,4 @@
1
- import type { Logger } from '@aztec/aztec.js';
2
- import { BBNativePrivateKernelProver } from '@aztec/bb-prover/client/native';
3
- import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
1
+ import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
4
2
  import { createLogger, logger } from '@aztec/foundation/log';
5
3
  import { Timer } from '@aztec/foundation/timer';
6
4
  import { WASMSimulator } from '@aztec/simulator/client';
@@ -11,26 +9,7 @@ import { Decoder } from 'msgpackr';
11
9
  import { readFile, readdir, writeFile } from 'node:fs/promises';
12
10
  import { join } from 'node:path';
13
11
 
14
- import { type Log, type ProverType, ProxyLogger, generateBenchmark } from './benchmark.js';
15
-
16
- type NativeProverConfig = { bbBinaryPath?: string; bbWorkingDirectory?: string };
17
-
18
- async function createProver(config: NativeProverConfig = {}, log: Logger) {
19
- const simulator = new WASMSimulator();
20
- if (!config.bbBinaryPath || !config.bbWorkingDirectory) {
21
- return { prover: new BBWASMBundlePrivateKernelProver(simulator, 16, log), type: 'wasm' as ProverType };
22
- } else {
23
- const bbConfig = config as Required<NativeProverConfig>;
24
- return {
25
- prover: await BBNativePrivateKernelProver.new(
26
- { bbSkipCleanup: false, numConcurrentIVCVerifiers: 1, bbIVCConcurrency: 1, ...bbConfig },
27
- simulator,
28
- log,
29
- ),
30
- type: 'native' as ProverType,
31
- };
32
- }
33
- }
12
+ import { type Log, ProxyLogger, generateBenchmark } from './benchmark.js';
34
13
 
35
14
  async function main() {
36
15
  ProxyLogger.create();
@@ -41,12 +20,11 @@ async function main() {
41
20
  }
42
21
  const flows = await readdir(ivcFolder);
43
22
  logger.info(`Flows in ${ivcFolder}: \n${flows.map(flowName => `\t- ${flowName}`).join('\n')}`);
44
- const { prover, type: proverType } = await createProver(
45
- { bbBinaryPath: process.env.BB_BINARY_PATH, bbWorkingDirectory: process.env.BB_WORKING_DIRECTORY },
46
- proxyLogger.createLogger('bb:prover'),
47
- );
23
+ const simulator = new WASMSimulator();
24
+ const log = proxyLogger.createLogger('bb:prover');
25
+ const prover = new BBBundlePrivateKernelProver(simulator, log);
48
26
 
49
- const userLog = createLogger('client_ivc_flows:data_processor');
27
+ const userLog = createLogger('chonk_flows:data_processor');
50
28
 
51
29
  for (const flow of flows) {
52
30
  userLog.info(`Processing flow ${flow}`);
@@ -84,10 +62,10 @@ async function main() {
84
62
  let provingTime;
85
63
  try {
86
64
  const provingTimer = new Timer();
87
- await prover.createClientIvcProof(privateExecutionSteps);
65
+ await prover.createChonkProof(privateExecutionSteps);
88
66
  provingTime = provingTimer.ms();
89
67
  } catch (e) {
90
- userLog.error(`Failed to generate client ivc proof for ${flow}`, e);
68
+ userLog.error(`Failed to generate chonk proof for ${flow}`, e);
91
69
  error = (e as Error).message;
92
70
  }
93
71
  // Extract logs from this run from the proxy and write them to disk unconditionally
@@ -96,7 +74,7 @@ async function main() {
96
74
  if (!(profile.stats.timings as ProvingTimings).proving) {
97
75
  (profile.stats.timings as ProvingTimings).proving = provingTime;
98
76
  }
99
- const benchmark = generateBenchmark(flow, currentLogs, profile.stats, privateExecutionSteps, proverType, error);
77
+ const benchmark = generateBenchmark(flow, currentLogs, profile.stats, privateExecutionSteps, 'native', error);
100
78
  await writeFile(join(ivcFolder, flow, 'benchmark.json'), JSON.stringify(benchmark, null, 2));
101
79
  proxyLogger.flushLogs();
102
80
  }
@@ -1,8 +1,7 @@
1
1
  import type { AztecNodeService } from '@aztec/aztec-node';
2
- import { type AztecNode, BatchCall, type SentTx, type WaitOpts } from '@aztec/aztec.js';
2
+ import { BatchCall, type SentTx, type WaitOpts } from '@aztec/aztec.js/contracts';
3
3
  import { mean, stdDev, times } from '@aztec/foundation/collection';
4
4
  import { BenchmarkingContract } from '@aztec/noir-test-contracts.js/Benchmarking';
5
- import { type PXEService, type PXEServiceConfig, createPXEService } from '@aztec/pxe/server';
6
5
  import type { MetricsType } from '@aztec/telemetry-client';
7
6
  import type { BenchmarkDataPoint, BenchmarkMetricsType, BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
8
7
 
@@ -22,9 +21,8 @@ export async function benchmarkSetup(
22
21
  },
23
22
  ) {
24
23
  const context = await setup(1, { ...opts, telemetryConfig: { benchmark: true } });
25
- const contract = await BenchmarkingContract.deploy(context.wallet)
26
- .send({ from: context.wallet.getAddress() })
27
- .deployed();
24
+ const defaultAccountAddress = context.accounts[0];
25
+ const contract = await BenchmarkingContract.deploy(context.wallet).send({ from: defaultAccountAddress }).deployed();
28
26
  context.logger.info(`Deployed benchmarking contract at ${contract.address}`);
29
27
  const sequencer = (context.aztecNode as AztecNodeService).getSequencer()!;
30
28
  const telemetry = context.telemetryClient! as BenchmarkTelemetryClient;
@@ -111,9 +109,9 @@ function makeCall(
111
109
  contract: BenchmarkingContract,
112
110
  heavyPublicCompute: boolean,
113
111
  ) {
114
- const owner = context.wallet.getAddress();
112
+ const [owner] = context.accounts;
115
113
  if (heavyPublicCompute) {
116
- return new BatchCall(context.wallet, [contract.methods.sha256_hash_2048(randomBytesAsBigInts(2048))]);
114
+ return new BatchCall(context.wallet, [contract.methods.sha256_hash_1024(randomBytesAsBigInts(1024))]);
117
115
  } else {
118
116
  return new BatchCall(context.wallet, [
119
117
  contract.methods.create_note(owner, index + 1),
@@ -131,17 +129,17 @@ function makeCall(
131
129
  * @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
132
130
  * @returns Array of sent txs.
133
131
  */
134
- export async function sendTxs(
132
+ export function sendTxs(
135
133
  txCount: number,
136
134
  context: EndToEndContext,
137
135
  contract: BenchmarkingContract,
138
136
  heavyPublicCompute: boolean = false,
139
- ): Promise<SentTx[]> {
137
+ ): SentTx[] {
140
138
  const calls = times(txCount, index => makeCall(index, context, contract, heavyPublicCompute));
141
139
  context.logger.info(`Creating ${txCount} txs`);
142
- const provenTxs = await Promise.all(calls.map(call => call.prove({ from: context.wallet.getAddress() })));
140
+ const [from] = context.accounts;
143
141
  context.logger.info(`Sending ${txCount} txs`);
144
- return provenTxs.map(tx => tx.send());
142
+ return calls.map(call => call.send({ from }));
145
143
  }
146
144
 
147
145
  export async function waitTxs(txs: SentTx[], context: EndToEndContext, txWaitOpts?: WaitOpts) {
@@ -150,32 +148,6 @@ export async function waitTxs(txs: SentTx[], context: EndToEndContext, txWaitOpt
150
148
  context.logger.info(`All ${txs.length} txs have been mined`);
151
149
  }
152
150
 
153
- /**
154
- * Creates a new PXE
155
- * @param node - Node to connect the pxe to.
156
- * @param contract - Benchmark contract to add to the pxe.
157
- * @param startingBlock - First l2 block to process.
158
- * @returns The new PXE.
159
- */
160
- export async function createNewPXE(node: AztecNode, contract: BenchmarkingContract): Promise<PXEService> {
161
- const l1Contracts = await node.getL1ContractAddresses();
162
- const { l1ChainId, rollupVersion } = await node.getNodeInfo();
163
- const pxeConfig = {
164
- l2BlockBatchSize: 50,
165
- l2BlockPollingIntervalMS: 100,
166
- dataDirectory: undefined,
167
- dataStoreMapSizeKB: 1024 * 1024,
168
- l1Contracts,
169
- l1ChainId,
170
- rollupVersion,
171
- } as PXEServiceConfig;
172
- // docs:start:PXEcreate
173
- const pxe = await createPXEService(node, pxeConfig);
174
- // docs:end:PXEcreate
175
- await pxe.registerContract(contract);
176
- return pxe;
177
- }
178
-
179
151
  function randomBytesAsBigInts(length: number): bigint[] {
180
152
  return [...Array(length)].map(_ => BigInt(Math.floor(Math.random() * 255)));
181
153
  }
@@ -1,21 +1,15 @@
1
- import { getSchnorrWallet } from '@aztec/accounts/schnorr';
2
- import {
3
- type AccountWallet,
4
- AztecAddress,
5
- type AztecNode,
6
- type CompleteAddress,
7
- Fr,
8
- type Logger,
9
- type PXE,
10
- type TxHash,
11
- computeSecretHash,
12
- createLogger,
13
- } from '@aztec/aztec.js';
1
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import { computeSecretHash } from '@aztec/aztec.js/crypto';
3
+ import { Fr } from '@aztec/aztec.js/fields';
4
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
5
+ import type { AztecNode } from '@aztec/aztec.js/node';
6
+ import type { TxHash } from '@aztec/aztec.js/tx';
14
7
  import type { CheatCodes } from '@aztec/aztec/testing';
15
8
  import type { TokenContract } from '@aztec/noir-contracts.js/Token';
16
9
  import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
17
10
  import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
18
11
  import type { SequencerClient } from '@aztec/sequencer-client';
12
+ import type { TestWallet } from '@aztec/test-wallet/server';
19
13
 
20
14
  import { jest } from '@jest/globals';
21
15
 
@@ -63,9 +57,7 @@ export class BlacklistTokenContractTest {
63
57
 
64
58
  private snapshotManager: ISnapshotManager;
65
59
  logger: Logger;
66
- wallets: AccountWallet[] = [];
67
- pxe!: PXE;
68
- accounts: CompleteAddress[] = [];
60
+ wallet!: TestWallet;
69
61
  asset!: TokenBlacklistContract;
70
62
  tokenSim!: TokenSimulator;
71
63
  badAccount!: InvalidAccountContract;
@@ -73,11 +65,8 @@ export class BlacklistTokenContractTest {
73
65
  sequencer!: SequencerClient;
74
66
  aztecNode!: AztecNode;
75
67
 
76
- admin!: AccountWallet;
77
68
  adminAddress!: AztecAddress;
78
- other!: AccountWallet;
79
69
  otherAddress!: AztecAddress;
80
- blacklisted!: AccountWallet;
81
70
  blacklistedAddress!: AztecAddress;
82
71
 
83
72
  constructor(testName: string) {
@@ -105,19 +94,15 @@ export class BlacklistTokenContractTest {
105
94
  await this.snapshotManager.snapshot(
106
95
  '3_accounts',
107
96
  deployAccounts(3, this.logger),
108
- async ({ deployedAccounts }, { pxe, cheatCodes, aztecNode, sequencer }) => {
109
- this.pxe = pxe;
97
+ ({ deployedAccounts }, { cheatCodes, aztecNode, sequencer, wallet }) => {
110
98
  this.cheatCodes = cheatCodes;
111
99
  this.aztecNode = aztecNode;
112
100
  this.sequencer = sequencer;
113
- this.wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
114
- this.admin = this.wallets[0];
115
- this.adminAddress = this.admin.getAddress();
116
- this.other = this.wallets[1];
117
- this.otherAddress = this.other.getAddress();
118
- this.blacklisted = this.wallets[2];
119
- this.blacklistedAddress = this.blacklisted.getAddress();
120
- this.accounts = this.wallets.map(w => w.getCompleteAddress());
101
+ this.wallet = wallet;
102
+ this.adminAddress = deployedAccounts[0].address;
103
+ this.otherAddress = deployedAccounts[1].address;
104
+ this.blacklistedAddress = deployedAccounts[2].address;
105
+ return Promise.resolve();
121
106
  },
122
107
  );
123
108
 
@@ -127,16 +112,16 @@ export class BlacklistTokenContractTest {
127
112
  // Create the token contract state.
128
113
  // Move this account thing to addAccounts above?
129
114
  this.logger.verbose(`Public deploy accounts...`);
130
- await publicDeployAccounts(this.admin, this.accounts.slice(0, 3));
115
+ await publicDeployAccounts(this.wallet, [this.adminAddress, this.otherAddress, this.blacklistedAddress]);
131
116
 
132
117
  this.logger.verbose(`Deploying TokenContract...`);
133
- this.asset = await TokenBlacklistContract.deploy(this.admin, this.adminAddress)
118
+ this.asset = await TokenBlacklistContract.deploy(this.wallet, this.adminAddress)
134
119
  .send({ from: this.adminAddress })
135
120
  .deployed();
136
121
  this.logger.verbose(`Token deployed to ${this.asset.address}`);
137
122
 
138
123
  this.logger.verbose(`Deploying bad account...`);
139
- this.badAccount = await InvalidAccountContract.deploy(this.admin).send({ from: this.adminAddress }).deployed();
124
+ this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({ from: this.adminAddress }).deployed();
140
125
  this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
141
126
 
142
127
  await this.crossTimestampOfChange();
@@ -145,18 +130,18 @@ export class BlacklistTokenContractTest {
145
130
  },
146
131
  async ({ tokenContractAddress, badAccountAddress }) => {
147
132
  // Restore the token contract state.
148
- this.asset = await TokenBlacklistContract.at(tokenContractAddress, this.wallets[0]);
133
+ this.asset = TokenBlacklistContract.at(tokenContractAddress, this.wallet);
149
134
  this.logger.verbose(`Token contract address: ${this.asset.address}`);
150
135
 
151
136
  this.tokenSim = new TokenSimulator(
152
137
  this.asset as unknown as TokenContract,
153
- this.admin,
138
+ this.wallet,
154
139
  this.adminAddress,
155
140
  this.logger,
156
- this.accounts.map(a => a.address),
141
+ [this.adminAddress, this.otherAddress, this.blacklistedAddress],
157
142
  );
158
143
 
159
- this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallets[0]);
144
+ this.badAccount = InvalidAccountContract.at(badAccountAddress, this.wallet);
160
145
  this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
161
146
 
162
147
  expect(await this.asset.methods.get_roles(this.adminAddress).simulate({ from: this.adminAddress })).toEqual(
@@ -187,7 +172,7 @@ export class BlacklistTokenContractTest {
187
172
  secretHash: Fr,
188
173
  txHash: TxHash,
189
174
  ) {
190
- const txEffects = await this.pxe.getTxEffect(txHash);
175
+ const txEffects = await this.aztecNode.getTxEffect(txHash);
191
176
  await contract.methods
192
177
  .deliver_transparent_note(
193
178
  contract.address,
@@ -205,40 +190,38 @@ export class BlacklistTokenContractTest {
205
190
  await this.snapshotManager.snapshot(
206
191
  'mint',
207
192
  async () => {
208
- const { asset, accounts, wallets } = this;
193
+ const { asset } = this;
209
194
  const amount = 10000n;
210
195
 
211
196
  const adminMinterRole = new Role().withAdmin().withMinter();
212
- await this.asset
213
- .withWallet(this.admin)
214
- .methods.update_roles(this.admin.getAddress(), adminMinterRole.toNoirStruct())
197
+ await this.asset.methods
198
+ .update_roles(this.adminAddress, adminMinterRole.toNoirStruct())
215
199
  .send({ from: this.adminAddress })
216
200
  .wait();
217
201
 
218
202
  const blacklistRole = new Role().withBlacklisted();
219
- await this.asset
220
- .withWallet(this.admin)
221
- .methods.update_roles(this.blacklisted.getAddress(), blacklistRole.toNoirStruct())
203
+ await this.asset.methods
204
+ .update_roles(this.blacklistedAddress, blacklistRole.toNoirStruct())
222
205
  .send({ from: this.adminAddress })
223
206
  .wait();
224
207
 
225
208
  await this.crossTimestampOfChange();
226
209
 
227
- expect(
228
- await this.asset.methods.get_roles(this.admin.getAddress()).simulate({ from: this.adminAddress }),
229
- ).toEqual(adminMinterRole.toNoirStruct());
210
+ expect(await this.asset.methods.get_roles(this.adminAddress).simulate({ from: this.adminAddress })).toEqual(
211
+ adminMinterRole.toNoirStruct(),
212
+ );
230
213
 
231
214
  this.logger.verbose(`Minting ${amount} publicly...`);
232
- await asset.methods.mint_public(accounts[0].address, amount).send({ from: this.adminAddress }).wait();
215
+ await asset.methods.mint_public(this.adminAddress, amount).send({ from: this.adminAddress }).wait();
233
216
 
234
217
  this.logger.verbose(`Minting ${amount} privately...`);
235
218
  const secret = Fr.random();
236
219
  const secretHash = await computeSecretHash(secret);
237
220
  const receipt = await asset.methods.mint_private(amount, secretHash).send({ from: this.adminAddress }).wait();
238
221
 
239
- await this.addPendingShieldNoteToPXE(asset, wallets[0].getAddress(), amount, secretHash, receipt.txHash);
222
+ await this.addPendingShieldNoteToPXE(asset, this.adminAddress, amount, secretHash, receipt.txHash);
240
223
  const txClaim = asset.methods
241
- .redeem_shield(accounts[0].address, amount, secret)
224
+ .redeem_shield(this.adminAddress, amount, secret)
242
225
  .send({ from: this.adminAddress });
243
226
  await txClaim.wait();
244
227
  this.logger.verbose(`Minting complete.`);
@@ -246,23 +229,23 @@ export class BlacklistTokenContractTest {
246
229
  return { amount };
247
230
  },
248
231
  async ({ amount }) => {
249
- const {
250
- asset,
251
- accounts: [{ address }],
252
- tokenSim,
253
- } = this;
254
- tokenSim.mintPublic(address, amount);
255
-
256
- const publicBalance = await asset.methods.balance_of_public(address).simulate({ from: address });
232
+ const { asset, tokenSim } = this;
233
+ tokenSim.mintPublic(this.adminAddress, amount);
234
+
235
+ const publicBalance = await asset.methods
236
+ .balance_of_public(this.adminAddress)
237
+ .simulate({ from: this.adminAddress });
257
238
  this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
258
- expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
239
+ expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(this.adminAddress));
259
240
 
260
- tokenSim.mintPrivate(address, amount);
261
- const privateBalance = await asset.methods.balance_of_private(address).simulate({ from: address });
241
+ tokenSim.mintPrivate(this.adminAddress, amount);
242
+ const privateBalance = await asset.methods
243
+ .balance_of_private(this.adminAddress)
244
+ .simulate({ from: this.adminAddress });
262
245
  this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
263
- expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
246
+ expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(this.adminAddress));
264
247
 
265
- const totalSupply = await asset.methods.total_supply().simulate({ from: address });
248
+ const totalSupply = await asset.methods.total_supply().simulate({ from: this.adminAddress });
266
249
  this.logger.verbose(`Total supply: ${totalSupply}`);
267
250
  expect(totalSupply).toEqual(tokenSim.totalSupply);
268
251
 
@@ -1,26 +1,20 @@
1
- import { getSchnorrWallet } from '@aztec/accounts/schnorr';
2
1
  import type { AztecNodeConfig } from '@aztec/aztec-node';
3
- import {
4
- type AccountWallet,
5
- AztecAddress,
6
- type AztecNode,
7
- type CompleteAddress,
8
- EthAddress,
9
- type Logger,
10
- type PXE,
11
- createLogger,
12
- } from '@aztec/aztec.js';
2
+ import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
3
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
4
+ import type { AztecNode } from '@aztec/aztec.js/node';
13
5
  import { CheatCodes } from '@aztec/aztec/testing';
6
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
14
7
  import {
8
+ type DeployL1ContractsArgs,
15
9
  type DeployL1ContractsReturnType,
16
- type ExtendedViemWalletClient,
17
- createExtendedL1Client,
18
10
  deployL1Contract,
19
- } from '@aztec/ethereum';
11
+ } from '@aztec/ethereum/deploy-l1-contracts';
12
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
20
13
  import { InboxAbi, OutboxAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts';
21
14
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
22
15
  import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
23
16
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
17
+ import type { TestWallet } from '@aztec/test-wallet/server';
24
18
 
25
19
  import { getContract } from 'viem';
26
20
 
@@ -32,6 +26,7 @@ import {
32
26
  deployAccounts,
33
27
  publicDeployAccounts,
34
28
  } from '../fixtures/snapshot_manager.js';
29
+ import type { SetupOptions } from '../fixtures/utils.js';
35
30
  import { CrossChainTestHarness } from '../shared/cross_chain_test_harness.js';
36
31
 
37
32
  const { E2E_DATA_PATH: dataPath } = process.env;
@@ -39,21 +34,19 @@ const { E2E_DATA_PATH: dataPath } = process.env;
39
34
  export class CrossChainMessagingTest {
40
35
  private snapshotManager: ISnapshotManager;
41
36
  logger: Logger;
42
- accounts: CompleteAddress[] = [];
43
37
  aztecNode!: AztecNode;
44
- pxe!: PXE;
45
38
  aztecNodeConfig!: AztecNodeConfig;
46
39
  aztecNodeAdmin!: AztecNodeAdmin;
40
+ ctx!: SubsystemsContext;
47
41
 
48
42
  l1Client!: ExtendedViemWalletClient | undefined;
49
43
 
50
- user1Wallet!: AccountWallet;
44
+ wallet!: TestWallet;
45
+ ownerAddress!: AztecAddress;
51
46
  user1Address!: AztecAddress;
52
- user2Wallet!: AccountWallet;
53
47
  user2Address!: AztecAddress;
54
48
  crossChainTestHarness!: CrossChainTestHarness;
55
49
  ethAccount!: EthAddress;
56
- ownerAddress!: AztecAddress;
57
50
  l2Token!: TokenContract;
58
51
  l2Bridge!: TokenBridgeContract;
59
52
 
@@ -63,9 +56,12 @@ export class CrossChainMessagingTest {
63
56
 
64
57
  deployL1ContractsValues!: DeployL1ContractsReturnType;
65
58
 
66
- constructor(testName: string) {
59
+ constructor(testName: string, opts: SetupOptions = {}, deployL1ContractsArgs: Partial<DeployL1ContractsArgs> = {}) {
67
60
  this.logger = createLogger(`e2e:e2e_cross_chain_messaging:${testName}`);
68
- this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath);
61
+ this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath, opts, {
62
+ initialValidators: [],
63
+ ...deployL1ContractsArgs,
64
+ });
69
65
  }
70
66
 
71
67
  async assumeProven() {
@@ -73,13 +69,13 @@ export class CrossChainMessagingTest {
73
69
  }
74
70
 
75
71
  async setup() {
76
- const { aztecNode, pxe, aztecNodeConfig, deployL1ContractsValues } = await this.snapshotManager.setup();
77
- this.aztecNode = aztecNode;
78
- this.pxe = pxe;
79
- this.aztecNodeConfig = aztecNodeConfig;
80
- this.cheatCodes = await CheatCodes.create(this.aztecNodeConfig.l1RpcUrls, this.pxe);
81
- this.deployL1ContractsValues = deployL1ContractsValues;
82
- this.aztecNodeAdmin = aztecNode;
72
+ this.ctx = await this.snapshotManager.setup();
73
+ this.aztecNode = this.ctx.aztecNode;
74
+ this.wallet = this.ctx.wallet;
75
+ this.aztecNodeConfig = this.ctx.aztecNodeConfig;
76
+ this.cheatCodes = this.ctx.cheatCodes;
77
+ this.deployL1ContractsValues = this.ctx.deployL1ContractsValues;
78
+ this.aztecNodeAdmin = this.ctx.aztecNode;
83
79
  }
84
80
 
85
81
  snapshot = <T>(
@@ -93,25 +89,18 @@ export class CrossChainMessagingTest {
93
89
  }
94
90
 
95
91
  async applyBaseSnapshots() {
96
- // Note that we are using the same `pxe`, `aztecNodeConfig` and `aztecNode` across all snapshots.
92
+ // Note that we are using the same `wallet`, `aztecNodeConfig` and `aztecNode` across all snapshots.
97
93
  // This is to not have issues with different networks.
98
94
 
99
95
  await this.snapshotManager.snapshot(
100
96
  '3_accounts',
101
97
  deployAccounts(3, this.logger),
102
- async ({ deployedAccounts }, { pxe, aztecNodeConfig, aztecNode }) => {
103
- const wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
104
- this.accounts = wallets.map(w => w.getCompleteAddress());
105
- wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
106
-
107
- this.user1Wallet = wallets[0];
108
- this.user1Address = this.user1Wallet.getAddress();
109
- this.user2Wallet = wallets[1];
110
- this.user2Address = this.user2Wallet.getAddress();
111
-
112
- this.pxe = pxe;
98
+ ({ deployedAccounts }, { wallet, aztecNodeConfig, aztecNode }) => {
99
+ [this.ownerAddress, this.user1Address, this.user2Address] = deployedAccounts.map(a => a.address);
100
+ this.wallet = wallet;
113
101
  this.aztecNode = aztecNode;
114
102
  this.aztecNodeConfig = aztecNodeConfig;
103
+ return Promise.resolve();
115
104
  },
116
105
  );
117
106
 
@@ -121,7 +110,7 @@ export class CrossChainMessagingTest {
121
110
  // Create the token contract state.
122
111
  // Move this account thing to addAccounts above?
123
112
  this.logger.verbose(`Public deploy accounts...`);
124
- await publicDeployAccounts(this.user1Wallet, this.accounts.slice(0, 3));
113
+ await publicDeployAccounts(this.wallet, [this.ownerAddress, this.user1Address, this.user2Address]);
125
114
 
126
115
  this.l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
127
116
 
@@ -134,10 +123,9 @@ export class CrossChainMessagingTest {
134
123
  this.logger.verbose(`Setting up cross chain harness...`);
135
124
  this.crossChainTestHarness = await CrossChainTestHarness.new(
136
125
  this.aztecNode,
137
- this.pxe,
138
126
  this.l1Client,
139
- this.user1Wallet,
140
- this.user1Address,
127
+ this.wallet,
128
+ this.ownerAddress,
141
129
  this.logger,
142
130
  underlyingERC20Address,
143
131
  );
@@ -146,13 +134,12 @@ export class CrossChainMessagingTest {
146
134
 
147
135
  return this.crossChainTestHarness.toCrossChainContext();
148
136
  },
149
- async crossChainContext => {
150
- this.l2Token = await TokenContract.at(crossChainContext.l2Token, this.user1Wallet);
151
- this.l2Bridge = await TokenBridgeContract.at(crossChainContext.l2Bridge, this.user1Wallet);
137
+ crossChainContext => {
138
+ this.l2Token = TokenContract.at(crossChainContext.l2Token, this.wallet);
139
+ this.l2Bridge = TokenBridgeContract.at(crossChainContext.l2Bridge, this.wallet);
152
140
 
153
141
  // There is an issue with the reviver so we are getting strings sometimes. Working around it here.
154
142
  this.ethAccount = EthAddress.fromString(crossChainContext.ethAccount.toString());
155
- this.ownerAddress = AztecAddress.fromString(crossChainContext.ownerAddress.toString());
156
143
  const tokenPortalAddress = EthAddress.fromString(crossChainContext.tokenPortal.toString());
157
144
 
158
145
  const l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
@@ -170,7 +157,6 @@ export class CrossChainMessagingTest {
170
157
 
171
158
  this.crossChainTestHarness = new CrossChainTestHarness(
172
159
  this.aztecNode,
173
- this.pxe,
174
160
  this.logger,
175
161
  this.l2Token,
176
162
  this.l2Bridge,
@@ -179,13 +165,14 @@ export class CrossChainMessagingTest {
179
165
  crossChainContext.underlying,
180
166
  l1Client,
181
167
  this.aztecNodeConfig.l1Contracts,
182
- this.user1Wallet,
183
- this.user1Address,
168
+ this.wallet,
169
+ this.ownerAddress,
184
170
  );
185
171
 
186
172
  this.l1Client = l1Client;
187
173
  this.inbox = inbox;
188
174
  this.outbox = outbox;
175
+ return Promise.resolve();
189
176
  },
190
177
  );
191
178
  }