@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,28 +1,28 @@
1
- import { getSchnorrAccount } from '@aztec/accounts/schnorr';
2
1
  import type { InitialAccountData } from '@aztec/accounts/testing';
3
2
  import type { AztecNodeService } from '@aztec/aztec-node';
4
- import {
5
- AztecAddress,
6
- Fr,
7
- type Logger,
8
- ProvenTx,
9
- type SentTx,
10
- TxStatus,
11
- getContractInstanceFromInstantiationParams,
12
- retryUntil,
13
- } from '@aztec/aztec.js';
3
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
4
+ import { type SentTx, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
5
+ import { Fr } from '@aztec/aztec.js/fields';
6
+ import type { Logger } from '@aztec/aztec.js/log';
7
+ import { Tx, TxStatus } from '@aztec/aztec.js/tx';
14
8
  import type { RollupCheatCodes } from '@aztec/aztec/testing';
15
- import type { EmpireSlashingProposerContract, RollupContract, TallySlashingProposerContract } from '@aztec/ethereum';
9
+ import type {
10
+ EmpireSlashingProposerContract,
11
+ RollupContract,
12
+ TallySlashingProposerContract,
13
+ } from '@aztec/ethereum/contracts';
14
+ import { EpochNumber } from '@aztec/foundation/branded-types';
16
15
  import { timesAsync, unique } from '@aztec/foundation/collection';
17
- import type { TestDateProvider } from '@aztec/foundation/timer';
16
+ import { retryUntil } from '@aztec/foundation/retry';
17
+ import { pluralize } from '@aztec/foundation/string';
18
18
  import type { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
19
19
  import { TestContract, TestContractArtifact } from '@aztec/noir-test-contracts.js/Test';
20
- import { PXEService, createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe/server';
20
+ import { getPXEConfig, getPXEConfig as getRpcConfig } from '@aztec/pxe/server';
21
21
  import { getRoundForOffense } from '@aztec/slasher';
22
22
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
23
23
  import type { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
24
+ import { TestWallet, proveInteraction } from '@aztec/test-wallet/server';
24
25
 
25
- import type { NodeContext } from '../fixtures/setup_p2p_test.js';
26
26
  import { submitTxsTo } from '../shared/submit-transactions.js';
27
27
 
28
28
  // submits a set of transactions to the provided Private eXecution Environment (PXE)
@@ -55,56 +55,46 @@ export const submitComplexTxsTo = async (
55
55
  return txs;
56
56
  };
57
57
 
58
- // creates an instance of the PXE and submit a given number of transactions to it.
59
- export const createPXEServiceAndSubmitTransactions = async (
58
+ // creates a wallet and submit a given number of transactions through it.
59
+ export const submitTransactions = async (
60
60
  logger: Logger,
61
61
  node: AztecNodeService,
62
62
  numTxs: number,
63
63
  fundedAccount: InitialAccountData,
64
- ): Promise<NodeContext> => {
64
+ ): Promise<SentTx[]> => {
65
65
  const rpcConfig = getRpcConfig();
66
66
  rpcConfig.proverEnabled = false;
67
- const pxeService = await createPXEService(node, rpcConfig, { useLogSuffix: true });
68
-
69
- const account = await getSchnorrAccount(
70
- pxeService,
71
- fundedAccount.secret,
72
- fundedAccount.signingKey,
73
- fundedAccount.salt,
74
- );
75
- await account.register();
76
- const wallet = await account.getWallet();
77
-
78
- const txs = await submitTxsTo(pxeService, numTxs, wallet, logger);
79
- return { txs, pxeService, node };
67
+ const wallet = await TestWallet.create(node, { ...getPXEConfig(), proverEnabled: false }, { useLogSuffix: true });
68
+ const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
69
+ return submitTxsTo(wallet, fundedAccountManager.address, numTxs, logger);
80
70
  };
81
71
 
82
- export async function createPXEServiceAndPrepareTransactions(
72
+ export async function prepareTransactions(
83
73
  logger: Logger,
84
74
  node: AztecNodeService,
85
75
  numTxs: number,
86
76
  fundedAccount: InitialAccountData,
87
- ): Promise<{ pxeService: PXEService; txs: ProvenTx[]; node: AztecNodeService }> {
77
+ ): Promise<Tx[]> {
88
78
  const rpcConfig = getRpcConfig();
89
79
  rpcConfig.proverEnabled = false;
90
- const pxe = await createPXEService(node, rpcConfig, { useLogSuffix: true });
91
80
 
92
- const account = await getSchnorrAccount(pxe, fundedAccount.secret, fundedAccount.signingKey, fundedAccount.salt);
93
- await account.register();
94
- const wallet = await account.getWallet();
81
+ const wallet = await TestWallet.create(node, { ...getPXEConfig(), proverEnabled: false }, { useLogSuffix: true });
82
+ const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
95
83
 
96
- const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {});
97
- await wallet.registerContract({ instance: testContractInstance, artifact: TestContractArtifact });
98
- const contract = await TestContract.at(testContractInstance.address, wallet);
84
+ const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {
85
+ salt: Fr.random(),
86
+ });
87
+ await wallet.registerContract(testContractInstance, TestContractArtifact);
88
+ const contract = TestContract.at(testContractInstance.address, wallet);
99
89
 
100
- const txs = await timesAsync(numTxs, async () => {
101
- const tx = await contract.methods.emit_nullifier(Fr.random()).prove({ from: account.getAddress() });
90
+ return timesAsync(numTxs, async () => {
91
+ const tx = await proveInteraction(wallet, contract.methods.emit_nullifier(Fr.random()), {
92
+ from: fundedAccountManager.address,
93
+ });
102
94
  const txHash = tx.getTxHash();
103
95
  logger.info(`Tx prepared with hash ${txHash}`);
104
96
  return tx;
105
97
  });
106
-
107
- return { txs, pxeService: pxe, node };
108
98
  }
109
99
 
110
100
  export function awaitProposalExecution(
@@ -164,26 +154,31 @@ export async function awaitOffenseDetected({
164
154
  nodeAdmin,
165
155
  slashingRoundSize,
166
156
  epochDuration,
157
+ waitUntilOffenseCount,
158
+ timeoutSeconds = 120,
167
159
  }: {
168
160
  nodeAdmin: AztecNodeAdmin;
169
161
  logger: Logger;
170
162
  slashingRoundSize: number;
171
163
  epochDuration: number;
164
+ waitUntilOffenseCount?: number;
165
+ timeoutSeconds?: number;
172
166
  }) {
173
- logger.info(`Waiting for an offense to be detected`);
167
+ const targetOffenseCount = waitUntilOffenseCount ?? 1;
168
+ logger.warn(`Waiting for ${pluralize('offense', targetOffenseCount)} to be detected`);
174
169
  const offenses = await retryUntil(
175
170
  async () => {
176
171
  const offenses = await nodeAdmin.getSlashOffenses('all');
177
- if (offenses.length > 0) {
172
+ if (offenses.length >= targetOffenseCount) {
178
173
  return offenses;
179
174
  }
180
175
  },
181
176
  'non-empty offenses',
182
- 60,
177
+ timeoutSeconds,
183
178
  );
184
179
  logger.info(
185
180
  `Hit ${offenses.length} offenses on rounds ${unique(offenses.map(o => getRoundForOffense(o, { slashingRoundSize, epochDuration })))}`,
186
- offenses,
181
+ { offenses },
187
182
  );
188
183
  return offenses;
189
184
  }
@@ -200,8 +195,9 @@ export async function awaitCommitteeKicked({
200
195
  slashingProposer,
201
196
  slashingRoundSize,
202
197
  aztecSlotDuration,
198
+ aztecEpochDuration,
203
199
  logger,
204
- dateProvider,
200
+ offenseEpoch,
205
201
  }: {
206
202
  rollup: RollupContract;
207
203
  cheatCodes: RollupCheatCodes;
@@ -210,20 +206,22 @@ export async function awaitCommitteeKicked({
210
206
  slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract | undefined;
211
207
  slashingRoundSize: number;
212
208
  aztecSlotDuration: number;
213
- dateProvider: TestDateProvider;
209
+ aztecEpochDuration: number;
214
210
  logger: Logger;
211
+ offenseEpoch: number;
215
212
  }) {
216
213
  if (!slashingProposer) {
217
214
  throw new Error('No slashing proposer configured. Cannot test slashing.');
218
215
  }
219
216
 
220
- logger.info(`Advancing epochs so we start slashing`);
221
217
  await cheatCodes.debugRollup();
222
- await cheatCodes.advanceToNextEpoch({ updateDateProvider: dateProvider });
223
- await cheatCodes.advanceToNextEpoch({ updateDateProvider: dateProvider });
224
218
 
225
- // Await for the slash payload to be created if empire (no payload is created on tally until execution time)
226
219
  if (slashingProposer.type === 'empire') {
220
+ // Await for the slash payload to be created if empire (no payload is created on tally until execution time)
221
+ const targetEpoch = BigInt(await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1n;
222
+ logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
223
+ await cheatCodes.advanceToEpoch(EpochNumber.fromBigInt(targetEpoch));
224
+
227
225
  const slashPayloadEvents = await retryUntil(
228
226
  async () => {
229
227
  const events = await slashFactory.getSlashPayloadCreatedEvents();
@@ -238,6 +236,15 @@ export async function awaitCommitteeKicked({
238
236
  expect(unique(slashPayloadEvents[0].slashes.map(slash => slash.validator.toString()))).toHaveLength(
239
237
  committee.length,
240
238
  );
239
+ } else {
240
+ // Use the slash offset to ensure we are in the right epoch for tally
241
+ const slashOffsetInRounds = await slashingProposer.getSlashOffsetInRounds();
242
+ const slashingRoundSizeInEpochs = slashingRoundSize / aztecEpochDuration;
243
+ const slashingOffsetInEpochs = Number(slashOffsetInRounds) * slashingRoundSizeInEpochs;
244
+ const firstEpochInOffenseRound = offenseEpoch - (offenseEpoch % slashingRoundSizeInEpochs);
245
+ const targetEpoch = firstEpochInOffenseRound + slashingOffsetInEpochs;
246
+ logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
247
+ await cheatCodes.advanceToEpoch(EpochNumber(targetEpoch), { offset: -aztecSlotDuration / 2 });
241
248
  }
242
249
 
243
250
  const attestersPre = await rollup.getAttesters();
@@ -248,7 +255,7 @@ export async function awaitCommitteeKicked({
248
255
  expect(attesterInfo.status).toEqual(1); // Validating
249
256
  }
250
257
 
251
- const timeout = slashingRoundSize * 2 * aztecSlotDuration;
258
+ const timeout = slashingRoundSize * 2 * aztecSlotDuration + 30;
252
259
  logger.info(`Waiting for slash to be executed (timeout ${timeout}s)`);
253
260
  await awaitProposalExecution(slashingProposer, timeout, logger);
254
261
 
@@ -265,10 +272,11 @@ export async function awaitCommitteeKicked({
265
272
  expect(attesterInfo.status).toEqual(2); // Living
266
273
  }
267
274
 
268
- logger.info(`Advancing two epochs to check current committee`);
275
+ logger.info(`Advancing to check current committee`);
269
276
  await cheatCodes.debugRollup();
270
- await cheatCodes.advanceToNextEpoch({ updateDateProvider: dateProvider });
271
- await cheatCodes.advanceToNextEpoch({ updateDateProvider: dateProvider });
277
+ await cheatCodes.advanceToEpoch(
278
+ EpochNumber.fromBigInt(BigInt(await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1n),
279
+ );
272
280
  await cheatCodes.debugRollup();
273
281
 
274
282
  const committeeNextEpoch = await rollup.getCurrentEpochCommittee();
@@ -1,7 +1,9 @@
1
- import { getSchnorrWallet } from '@aztec/accounts/schnorr';
2
- import { type AccountWallet, AztecAddress, type AztecNode, type Logger, createLogger } from '@aztec/aztec.js';
1
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
3
+ import type { AztecNode } from '@aztec/aztec.js/node';
3
4
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
4
5
  import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
6
+ import type { TestWallet } from '@aztec/test-wallet/server';
5
7
 
6
8
  import { jest } from '@jest/globals';
7
9
 
@@ -28,11 +30,9 @@ export class TokenContractTest {
28
30
  node!: AztecNode;
29
31
 
30
32
  badAccount!: InvalidAccountContract;
31
- admin!: AccountWallet;
33
+ wallet!: TestWallet;
32
34
  adminAddress!: AztecAddress;
33
- account1!: AccountWallet;
34
35
  account1Address!: AztecAddress;
35
- account2!: AccountWallet;
36
36
  account2Address!: AztecAddress;
37
37
 
38
38
  constructor(testName: string) {
@@ -54,11 +54,11 @@ export class TokenContractTest {
54
54
  await this.snapshotManager.snapshot(
55
55
  '3_accounts',
56
56
  deployAccounts(3, this.logger),
57
- async ({ deployedAccounts }, { pxe, aztecNode }) => {
57
+ ({ deployedAccounts }, { wallet, aztecNode }) => {
58
58
  this.node = aztecNode;
59
- const wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
60
- [this.admin, this.account1, this.account2] = wallets;
61
- [this.adminAddress, this.account1Address, this.account2Address] = wallets.map(w => w.getAddress());
59
+ this.wallet = wallet;
60
+ [this.adminAddress, this.account1Address, this.account2Address] = deployedAccounts.map(acc => acc.address);
61
+ return Promise.resolve();
62
62
  },
63
63
  );
64
64
 
@@ -68,11 +68,11 @@ export class TokenContractTest {
68
68
  // Create the token contract state.
69
69
  // Move this account thing to addAccounts above?
70
70
  this.logger.verbose(`Public deploy accounts...`);
71
- await publicDeployAccounts(this.admin, [this.adminAddress, this.account1Address]);
71
+ await publicDeployAccounts(this.wallet, [this.adminAddress, this.account1Address]);
72
72
 
73
73
  this.logger.verbose(`Deploying TokenContract...`);
74
74
  const asset = await TokenContract.deploy(
75
- this.admin,
75
+ this.wallet,
76
76
  this.adminAddress,
77
77
  TokenContractTest.TOKEN_NAME,
78
78
  TokenContractTest.TOKEN_SYMBOL,
@@ -83,22 +83,22 @@ export class TokenContractTest {
83
83
  this.logger.verbose(`Token deployed to ${asset.address}`);
84
84
 
85
85
  this.logger.verbose(`Deploying bad account...`);
86
- this.badAccount = await InvalidAccountContract.deploy(this.admin).send({ from: this.adminAddress }).deployed();
86
+ this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({ from: this.adminAddress }).deployed();
87
87
  this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
88
88
 
89
89
  return { tokenContractAddress: asset.address, badAccountAddress: this.badAccount.address };
90
90
  },
91
91
  async ({ tokenContractAddress, badAccountAddress }) => {
92
92
  // Restore the token contract state.
93
- this.asset = await TokenContract.at(tokenContractAddress, this.admin);
93
+ this.asset = TokenContract.at(tokenContractAddress, this.wallet);
94
94
  this.logger.verbose(`Token contract address: ${this.asset.address}`);
95
95
 
96
- this.tokenSim = new TokenSimulator(this.asset, this.admin, this.adminAddress, this.logger, [
96
+ this.tokenSim = new TokenSimulator(this.asset, this.wallet, this.adminAddress, this.logger, [
97
97
  this.adminAddress,
98
98
  this.account1Address,
99
99
  ]);
100
100
 
101
- this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.admin);
101
+ this.badAccount = InvalidAccountContract.at(badAccountAddress, this.wallet);
102
102
  this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
103
103
 
104
104
  expect(await this.asset.methods.get_admin().simulate({ from: this.adminAddress })).toBe(
@@ -131,14 +131,14 @@ export class TokenContractTest {
131
131
  await this.snapshotManager.snapshot(
132
132
  'mint',
133
133
  async () => {
134
- const { asset, admin, adminAddress } = this;
134
+ const { asset, adminAddress } = this;
135
135
  const amount = 10000n;
136
136
 
137
137
  this.logger.verbose(`Minting ${amount} publicly...`);
138
138
  await asset.methods.mint_to_public(adminAddress, amount).send({ from: adminAddress }).wait();
139
139
 
140
140
  this.logger.verbose(`Minting ${amount} privately...`);
141
- await mintTokensToPrivate(asset, adminAddress, admin, adminAddress, amount);
141
+ await mintTokensToPrivate(asset, adminAddress, adminAddress, amount);
142
142
  this.logger.verbose(`Minting complete.`);
143
143
 
144
144
  return { amount };
@@ -1,19 +1,8 @@
1
- import {
2
- SchnorrAccountContractArtifact,
3
- getSchnorrAccount,
4
- getSchnorrWalletWithSecretKey,
5
- } from '@aztec/accounts/schnorr';
6
1
  import type { InitialAccountData } from '@aztec/accounts/testing';
7
2
  import { type Archiver, createArchiver } from '@aztec/archiver';
8
- import {
9
- type AccountWalletWithSecretKey,
10
- type AztecNode,
11
- type CompleteAddress,
12
- EthAddress,
13
- type Logger,
14
- type PXE,
15
- createLogger,
16
- } from '@aztec/aztec.js';
3
+ import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
4
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
5
+ import type { AztecNode } from '@aztec/aztec.js/node';
17
6
  import { CheatCodes } from '@aztec/aztec/testing';
18
7
  import {
19
8
  BBCircuitVerifier,
@@ -21,16 +10,18 @@ import {
21
10
  QueuedIVCVerifier,
22
11
  TestCircuitVerifier,
23
12
  } from '@aztec/bb-prover';
13
+ import { BackendType, Barretenberg } from '@aztec/bb.js';
24
14
  import { createBlobSinkClient } from '@aztec/blob-sink/client';
25
15
  import type { BlobSinkServer } from '@aztec/blob-sink/server';
26
- import type { DeployL1ContractsReturnType } from '@aztec/ethereum';
16
+ import type { DeployL1ContractsReturnType } from '@aztec/ethereum/deploy-l1-contracts';
27
17
  import { Buffer32 } from '@aztec/foundation/buffer';
28
18
  import { SecretValue } from '@aztec/foundation/config';
29
19
  import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
30
20
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
31
21
  import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
32
- import type { PXEService } from '@aztec/pxe/server';
22
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
33
23
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
24
+ import { TestWallet } from '@aztec/test-wallet/server';
34
25
  import { getGenesisValues } from '@aztec/world-state/testing';
35
26
 
36
27
  import { type Hex, getContract } from 'viem';
@@ -46,12 +37,12 @@ import {
46
37
  deployAccounts,
47
38
  publicDeployAccounts,
48
39
  } from './snapshot_manager.js';
49
- import { getPrivateKeyFromIndex, getSponsoredFPCAddress, setupPXEService } from './utils.js';
40
+ import { getPrivateKeyFromIndex, getSponsoredFPCAddress, setupPXEAndGetWallet } from './utils.js';
50
41
 
51
42
  const { E2E_DATA_PATH: dataPath } = process.env;
52
43
 
53
44
  type ProvenSetup = {
54
- pxe: PXE;
45
+ wallet: TestWallet;
55
46
  teardown: () => Promise<void>;
56
47
  };
57
48
 
@@ -68,21 +59,22 @@ export class FullProverTest {
68
59
  static TOKEN_DECIMALS = 18n;
69
60
  private snapshotManager: ISnapshotManager;
70
61
  logger: Logger;
71
- deployedAccounts: InitialAccountData[] = [];
72
- wallets: AccountWalletWithSecretKey[] = [];
73
- accounts: CompleteAddress[] = [];
62
+ wallet!: TestWallet;
63
+ provenWallet!: TestWallet;
64
+ accounts: AztecAddress[] = [];
65
+ deployedAccounts!: InitialAccountData[];
74
66
  fakeProofsAsset!: TokenContract;
67
+ fakeProofsAssetInstance!: ContractInstanceWithAddress;
75
68
  tokenSim!: TokenSimulator;
76
69
  aztecNode!: AztecNode;
77
70
  aztecNodeAdmin!: AztecNodeAdmin;
78
- pxe!: PXEService;
79
71
  cheatCodes!: CheatCodes;
80
72
  blobSink!: BlobSinkServer;
81
73
  private provenComponents: ProvenSetup[] = [];
82
74
  private bbConfigCleanup?: () => Promise<void>;
83
75
  private acvmConfigCleanup?: () => Promise<void>;
84
76
  circuitProofVerifier?: ClientProtocolCircuitVerifier;
85
- provenAssets: TokenContract[] = [];
77
+ provenAsset!: TokenContract;
86
78
  private context!: SubsystemsContext;
87
79
  private proverNode!: ProverNode;
88
80
  private simulatedProverNode!: ProverNode;
@@ -115,13 +107,11 @@ export class FullProverTest {
115
107
  await this.snapshotManager.snapshot(
116
108
  '2_accounts',
117
109
  deployAccounts(2, this.logger),
118
- async ({ deployedAccounts }, { pxe }) => {
110
+ ({ deployedAccounts }, { wallet }) => {
119
111
  this.deployedAccounts = deployedAccounts;
120
- this.wallets = await Promise.all(
121
- deployedAccounts.map(a => getSchnorrWalletWithSecretKey(pxe, a.secret, a.signingKey, a.salt)),
122
- );
123
- this.accounts = this.wallets.map(w => w.getCompleteAddress());
124
- this.wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
112
+ this.accounts = deployedAccounts.map(a => a.address);
113
+ this.wallet = wallet;
114
+ return Promise.resolve();
125
115
  },
126
116
  );
127
117
 
@@ -131,37 +121,38 @@ export class FullProverTest {
131
121
  // Create the token contract state.
132
122
  // Move this account thing to addAccounts above?
133
123
  this.logger.verbose(`Public deploy accounts...`);
134
- await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 2));
124
+ await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
135
125
 
136
126
  this.logger.verbose(`Deploying TokenContract...`);
137
- const asset = await TokenContract.deploy(
138
- this.wallets[0],
127
+ const { contract: asset, instance } = await TokenContract.deploy(
128
+ this.wallet,
139
129
  this.accounts[0],
140
130
  FullProverTest.TOKEN_NAME,
141
131
  FullProverTest.TOKEN_SYMBOL,
142
132
  FullProverTest.TOKEN_DECIMALS,
143
133
  )
144
- .send({ from: this.wallets[0].getAddress() })
145
- .deployed();
134
+ .send({ from: this.accounts[0] })
135
+ .wait();
146
136
  this.logger.verbose(`Token deployed to ${asset.address}`);
147
137
 
148
- return { tokenContractAddress: asset.address };
138
+ return { tokenContractAddress: asset.address, tokenContractInstance: instance };
149
139
  },
150
- async ({ tokenContractAddress }) => {
140
+ async ({ tokenContractAddress, tokenContractInstance }) => {
151
141
  // Restore the token contract state.
152
- this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallets[0]);
142
+ this.fakeProofsAsset = TokenContract.at(tokenContractAddress, this.wallet);
143
+ this.fakeProofsAssetInstance = tokenContractInstance;
153
144
  this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
154
145
 
155
146
  this.tokenSim = new TokenSimulator(
156
147
  this.fakeProofsAsset,
157
- this.wallets[0],
158
- this.wallets[0].getAddress(),
148
+ this.wallet,
149
+ this.accounts[0],
159
150
  this.logger,
160
- this.accounts.map(a => a.address),
151
+ this.accounts,
161
152
  );
162
153
 
163
- expect(await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0].address })).toBe(
164
- this.accounts[0].address.toBigInt(),
154
+ expect(await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0] })).toBe(
155
+ this.accounts[0].toBigInt(),
165
156
  );
166
157
  },
167
158
  );
@@ -175,7 +166,6 @@ export class FullProverTest {
175
166
 
176
167
  this.simulatedProverNode = this.context.proverNode!;
177
168
  ({
178
- pxe: this.pxe,
179
169
  aztecNode: this.aztecNode,
180
170
  deployL1ContractsValues: this.l1Contracts,
181
171
  cheatCodes: this.cheatCodes,
@@ -197,9 +187,7 @@ export class FullProverTest {
197
187
  this.acvmConfigCleanup = acvmConfig.cleanup;
198
188
  this.bbConfigCleanup = bbConfig.cleanup;
199
189
 
200
- if (!bbConfig?.bbWorkingDirectory || !bbConfig?.bbBinaryPath) {
201
- throw new Error(`Test must be run with BB native configuration`);
202
- }
190
+ await Barretenberg.initSingleton({ backend: BackendType.NativeUnixSocket });
203
191
 
204
192
  const verifier = await BBCircuitVerifier.new(bbConfig);
205
193
  this.circuitProofVerifier = new QueuedIVCVerifier(bbConfig, verifier);
@@ -224,51 +212,27 @@ export class FullProverTest {
224
212
  await this.context.cheatCodes.rollup.markAsProven();
225
213
 
226
214
  this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
227
- for (let i = 0; i < 2; i++) {
228
- const result = await setupPXEService(
229
- this.aztecNode,
230
- {
231
- proverEnabled: this.realProofs,
232
- bbBinaryPath: bbConfig?.bbBinaryPath,
233
- bbWorkingDirectory: bbConfig?.bbWorkingDirectory,
234
- },
235
- undefined,
236
- true,
237
- );
238
- this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
239
- await result.pxe.registerContract(this.fakeProofsAsset);
240
-
241
- for (let i = 0; i < 2; i++) {
242
- await result.pxe.registerAccount(
243
- this.deployedAccounts[i].secret,
244
- this.wallets[i].getCompleteAddress().partialAddress,
245
- );
246
- await this.pxe.registerAccount(
247
- this.deployedAccounts[i].secret,
248
- this.wallets[i].getCompleteAddress().partialAddress,
249
- );
250
- }
251
-
252
- const account = await getSchnorrAccount(
253
- result.pxe,
254
- this.deployedAccounts[0].secret,
255
- this.deployedAccounts[0].signingKey,
256
- this.deployedAccounts[0].salt,
257
- );
258
-
259
- await result.pxe.registerContract({
260
- instance: account.getInstance(),
261
- artifact: SchnorrAccountContractArtifact,
262
- });
215
+ const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEAndGetWallet(
216
+ this.aztecNode,
217
+ { proverEnabled: this.realProofs },
218
+ undefined,
219
+ true,
220
+ );
221
+ this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
222
+ await provenWallet.registerContract(this.fakeProofsAssetInstance, TokenContract.artifact);
263
223
 
264
- const provenWallet = await account.getWallet();
265
- const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
266
- this.provenComponents.push({
267
- pxe: result.pxe,
268
- teardown: result.teardown,
269
- });
270
- this.provenAssets.push(asset);
224
+ for (let i = 0; i < 2; i++) {
225
+ await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
226
+ await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
271
227
  }
228
+
229
+ const asset = TokenContract.at(this.fakeProofsAsset.address, provenWallet);
230
+ this.provenComponents.push({
231
+ wallet: provenWallet,
232
+ teardown: provenTeardown,
233
+ });
234
+ this.provenAsset = asset;
235
+ this.provenWallet = provenWallet;
272
236
  this.logger.info(`Full prover PXE started`);
273
237
 
274
238
  // Shutdown the current, simulated prover node
@@ -279,7 +243,7 @@ export class FullProverTest {
279
243
  this.logger.verbose('Starting archiver for new prover node');
280
244
  const archiver = await createArchiver(
281
245
  { ...this.context.aztecNodeConfig, dataDirectory: undefined },
282
- { blobSinkClient },
246
+ { blobSinkClient, dateProvider: this.context.dateProvider },
283
247
  { blockUntilSync: true },
284
248
  );
285
249
 
@@ -308,6 +272,7 @@ export class FullProverTest {
308
272
  txGatheringMaxParallelRequestsPerNode: 100,
309
273
  txGatheringTimeoutMs: 24_000,
310
274
  proverNodeFailedEpochStore: undefined,
275
+ proverNodeEpochProvingDelayMs: undefined,
311
276
  };
312
277
  const sponsoredFPCAddress = await getSponsoredFPCAddress();
313
278
  const { prefilledPublicData } = await getGenesisValues(
@@ -354,6 +319,7 @@ export class FullProverTest {
354
319
  // clean up the full prover node
355
320
  await this.proverNode.stop();
356
321
 
322
+ await Barretenberg.destroySingleton();
357
323
  await this.bbConfigCleanup?.();
358
324
  await this.acvmConfigCleanup?.();
359
325
  }
@@ -368,15 +334,12 @@ export class FullProverTest {
368
334
 
369
335
  this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
370
336
  await asset.methods
371
- .mint_to_public(accounts[0].address, privateAmount + publicAmount)
372
- .send({ from: accounts[0].address })
337
+ .mint_to_public(accounts[0], privateAmount + publicAmount)
338
+ .send({ from: accounts[0] })
373
339
  .wait();
374
340
 
375
341
  this.logger.verbose(`Transferring ${privateAmount} to private...`);
376
- await asset.methods
377
- .transfer_to_private(accounts[0].address, privateAmount)
378
- .send({ from: accounts[0].address })
379
- .wait();
342
+ await asset.methods.transfer_to_private(accounts[0], privateAmount).send({ from: accounts[0] }).wait();
380
343
 
381
344
  this.logger.verbose(`Minting complete.`);
382
345
 
@@ -385,7 +348,7 @@ export class FullProverTest {
385
348
  async ({ amount }) => {
386
349
  const {
387
350
  fakeProofsAsset: asset,
388
- accounts: [{ address }],
351
+ accounts: [address],
389
352
  tokenSim,
390
353
  } = this;
391
354
  tokenSim.mintPublic(address, amount);
@@ -22,8 +22,7 @@ export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_s
22
22
  export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
23
23
  export const NO_L1_TO_L2_MSG_ERROR =
24
24
  /No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
25
- export const STATIC_CALL_STATE_MODIFICATION_ERROR =
26
- /Static call cannot update the state, emit L2->L1 messages or generate logs.*/;
25
+ export const STATIC_CALL_STATE_MODIFICATION_ERROR = /Static call cannot update the state.*/;
27
26
  export const STATIC_CONTEXT_ASSERTION_ERROR = /Assertion failed: Function .* can only be called statically.*/;
28
27
 
29
28
  export const DEFAULT_BLOB_SINK_PORT = '5052';
@@ -1,6 +1,6 @@
1
- import type { Logger } from '@aztec/aztec.js';
1
+ import type { Logger } from '@aztec/aztec.js/log';
2
2
  import { parseBooleanEnv } from '@aztec/foundation/config';
3
- import { randomBytes } from '@aztec/foundation/crypto';
3
+ import { randomBytes } from '@aztec/foundation/crypto/random';
4
4
  import { tryRmDir } from '@aztec/foundation/fs';
5
5
 
6
6
  import { promises as fs } from 'fs';