@aztec/end-to-end 0.84.0 → 0.85.0-alpha-testnet.0

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 (42) hide show
  1. package/dest/bench/utils.d.ts +1 -1
  2. package/dest/bench/utils.d.ts.map +1 -1
  3. package/dest/bench/utils.js +3 -3
  4. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +2 -2
  5. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  6. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +3 -3
  7. package/dest/e2e_epochs/epochs_test.d.ts +2 -2
  8. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  9. package/dest/e2e_epochs/epochs_test.js +10 -5
  10. package/dest/e2e_p2p/p2p_network.d.ts +235 -1
  11. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  12. package/dest/e2e_p2p/p2p_network.js +32 -18
  13. package/dest/e2e_p2p/shared.d.ts +7 -1
  14. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  15. package/dest/e2e_p2p/shared.js +30 -1
  16. package/dest/e2e_token_contract/token_contract_test.d.ts +2 -2
  17. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  18. package/dest/e2e_token_contract/token_contract_test.js +3 -3
  19. package/dest/fixtures/fixtures.d.ts.map +1 -1
  20. package/dest/fixtures/fixtures.js +1 -1
  21. package/dest/fixtures/snapshot_manager.js +2 -2
  22. package/dest/fixtures/utils.js +1 -1
  23. package/dest/shared/capture_private_execution_steps.d.ts.map +1 -1
  24. package/dest/shared/capture_private_execution_steps.js +29 -28
  25. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  26. package/dest/shared/cross_chain_test_harness.js +6 -2
  27. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  28. package/dest/spartan/setup_test_wallets.js +2 -1
  29. package/package.json +36 -39
  30. package/src/bench/utils.ts +3 -7
  31. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +4 -4
  32. package/src/e2e_epochs/epochs_test.ts +13 -5
  33. package/src/e2e_p2p/p2p_network.ts +39 -26
  34. package/src/e2e_p2p/shared.ts +33 -7
  35. package/src/e2e_token_contract/token_contract_test.ts +4 -4
  36. package/src/fixtures/fixtures.ts +1 -1
  37. package/src/fixtures/snapshot_manager.ts +2 -2
  38. package/src/fixtures/utils.ts +1 -1
  39. package/src/guides/up_quick_start.sh +1 -0
  40. package/src/shared/capture_private_execution_steps.ts +25 -28
  41. package/src/shared/cross_chain_test_harness.ts +4 -2
  42. package/src/spartan/setup_test_wallets.ts +2 -1
@@ -1,6 +1,6 @@
1
1
  import { getSchnorrWallet } from '@aztec/accounts/schnorr';
2
2
  import { type AccountWallet, type AztecNode, type CompleteAddress, type Logger, createLogger } from '@aztec/aztec.js';
3
- import { DocsExampleContract } from '@aztec/noir-contracts.js/DocsExample';
3
+ import { InvalidAccountContract } from '@aztec/noir-contracts.js/InvalidAccount';
4
4
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
5
5
 
6
6
  import { jest } from '@jest/globals';
@@ -27,7 +27,7 @@ export class TokenContractTest {
27
27
  accounts: CompleteAddress[] = [];
28
28
  asset!: TokenContract;
29
29
  tokenSim!: TokenSimulator;
30
- badAccount!: DocsExampleContract;
30
+ badAccount!: InvalidAccountContract;
31
31
  node!: AztecNode;
32
32
 
33
33
  constructor(testName: string) {
@@ -77,7 +77,7 @@ export class TokenContractTest {
77
77
  this.logger.verbose(`Token deployed to ${asset.address}`);
78
78
 
79
79
  this.logger.verbose(`Deploying bad account...`);
80
- this.badAccount = await DocsExampleContract.deploy(this.wallets[0]).send().deployed();
80
+ this.badAccount = await InvalidAccountContract.deploy(this.wallets[0]).send().deployed();
81
81
  this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
82
82
 
83
83
  return { tokenContractAddress: asset.address, badAccountAddress: this.badAccount.address };
@@ -94,7 +94,7 @@ export class TokenContractTest {
94
94
  this.accounts.map(a => a.address),
95
95
  );
96
96
 
97
- this.badAccount = await DocsExampleContract.at(badAccountAddress, this.wallets[0]);
97
+ this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallets[0]);
98
98
  this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
99
99
 
100
100
  expect(await this.asset.methods.get_admin().simulate()).toBe(this.accounts[0].address.toBigInt());
@@ -18,7 +18,7 @@ export const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with
18
18
  export const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow 'self + other'";
19
19
  export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
20
20
  // TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): Make these a fixed error after transition.
21
- export const DUPLICATE_NULLIFIER_ERROR = /dropped|duplicate nullifier|reverted|Nullifier collision/;
21
+ export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
22
22
  export const NO_L1_TO_L2_MSG_ERROR =
23
23
  /No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
24
24
  export const STATIC_CALL_STATE_MODIFICATION_ERROR =
@@ -414,7 +414,7 @@ async function setupFromFresh(
414
414
  {
415
415
  l1ChainId: aztecNodeConfig.l1ChainId,
416
416
  l1RpcUrls: aztecNodeConfig.l1RpcUrls,
417
- rollupAddress: aztecNodeConfig.l1Contracts.rollupAddress,
417
+ l1Contracts: aztecNodeConfig.l1Contracts,
418
418
  port: blobSinkPort,
419
419
  dataDirectory: aztecNodeConfig.dataDirectory,
420
420
  dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB,
@@ -537,7 +537,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
537
537
  {
538
538
  l1ChainId: aztecNodeConfig.l1ChainId,
539
539
  l1RpcUrls: aztecNodeConfig.l1RpcUrls,
540
- rollupAddress: aztecNodeConfig.l1Contracts.rollupAddress,
540
+ l1Contracts: aztecNodeConfig.l1Contracts,
541
541
  port: blobSinkPort,
542
542
  dataDirectory: statePath,
543
543
  dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB,
@@ -491,7 +491,7 @@ export async function setup(
491
491
  {
492
492
  l1ChainId: config.l1ChainId,
493
493
  l1RpcUrls: config.l1RpcUrls,
494
- rollupAddress: config.l1Contracts.rollupAddress,
494
+ l1Contracts: config.l1Contracts,
495
495
  port: blobSinkPort,
496
496
  dataDirectory: config.dataDirectory,
497
497
  dataStoreMapSizeKB: config.dataStoreMapSizeKB,
@@ -4,6 +4,7 @@
4
4
  set -eux
5
5
 
6
6
  export WALLET_DATA_DIRECTORY=$(mktemp -d)/up_quick_start
7
+ export PXE_PROVER="none"
7
8
 
8
9
  function on_exit {
9
10
  echo "Cleaning up $WALLET_DATA_DIRECTORY..."
@@ -22,24 +22,14 @@ const logger = createLogger('e2e:capture-private-execution-steps');
22
22
  // Longer term we won't use this hacked together msgpack format
23
23
  // Leaving duplicated as this eventually bb will provide a serialization
24
24
  // helper for passing to a generic msgpack RPC endpoint.
25
- async function _createClientIvcProofFiles(
26
- directory: string,
27
- executionSteps: PrivateExecutionStep[],
28
- rawWitnesses: boolean = false,
29
- ) {
25
+ async function _createClientIvcProofFiles(directory: string, executionSteps: PrivateExecutionStep[]) {
30
26
  const acirPath = path.join(directory, 'acir.msgpack');
31
27
  const witnessPath = path.join(directory, 'witnesses.msgpack');
32
28
  await fs.writeFile(acirPath, encode(executionSteps.map(map => map.bytecode)));
33
29
  await fs.writeFile(witnessPath, encode(executionSteps.map(map => serializeWitness(map.witness))));
34
- let rawWitnessesPath;
35
- if (rawWitnesses) {
36
- rawWitnessesPath = path.join(directory, 'witnesses.json');
37
- await fs.writeFile(rawWitnessesPath, JSON.stringify(executionSteps.map(step => Object.fromEntries(step.witness))));
38
- }
39
30
  return {
40
31
  acirPath,
41
32
  witnessPath,
42
- rawWitnessesPath,
43
33
  };
44
34
  }
45
35
 
@@ -51,21 +41,24 @@ export async function capturePrivateExecutionStepsIfEnvSet(
51
41
  ) {
52
42
  // Not included in env_var.ts as internal to e2e tests.
53
43
  const ivcFolder = process.env.CAPTURE_IVC_FOLDER;
54
- if (ivcFolder) {
55
- const profileMode = ['execution-steps', 'full'].includes(process.env.PROFILE_MODE ?? '')
56
- ? (process.env.PROFILE_MODE as 'full' | 'execution-steps')
57
- : 'execution-steps';
58
- logger.info(`Capturing client ivc execution profile for ${label} in mode ${profileMode}`);
59
- const result = await interaction.profile({
60
- ...opts,
61
- profileMode: profileMode,
62
- });
63
- if (expectedSteps !== undefined && result.executionSteps.length !== expectedSteps) {
64
- throw new Error(`Expected ${expectedSteps} execution steps, got ${result.executionSteps.length}`);
65
- }
66
- const resultsDirectory = path.join(ivcFolder, label);
67
- logger.info(`Writing private execution steps to ${resultsDirectory}`);
68
- await fs.mkdir(resultsDirectory, { recursive: true });
44
+ if (!ivcFolder) {
45
+ return;
46
+ }
47
+ const profileMode = ['execution-steps', 'full'].includes(process.env.PROFILE_MODE ?? '')
48
+ ? (process.env.PROFILE_MODE as 'full' | 'execution-steps')
49
+ : 'execution-steps';
50
+ logger.info(`Capturing client ivc execution profile for ${label} in mode ${profileMode}`);
51
+ const result = await interaction.profile({ ...opts, profileMode });
52
+ if (expectedSteps !== undefined && result.executionSteps.length !== expectedSteps) {
53
+ throw new Error(`Expected ${expectedSteps} execution steps, got ${result.executionSteps.length}`);
54
+ }
55
+ const resultsDirectory = path.join(ivcFolder, label);
56
+ logger.info(`Writing private execution steps to ${resultsDirectory}`);
57
+ await fs.mkdir(resultsDirectory, { recursive: true });
58
+ // Write the client IVC files read by the prover.
59
+ await _createClientIvcProofFiles(resultsDirectory, result.executionSteps);
60
+ if (profileMode === 'full') {
61
+ // If we have gate counts, write the steps in human-readable format.
69
62
  await fs.writeFile(
70
63
  path.join(resultsDirectory, 'steps.json'),
71
64
  JSON.stringify(
@@ -74,7 +67,11 @@ export async function capturePrivateExecutionStepsIfEnvSet(
74
67
  2,
75
68
  ),
76
69
  );
77
- await _createClientIvcProofFiles(resultsDirectory, result.executionSteps, profileMode === 'full');
78
- logger.info(`Wrote private execution steps to ${resultsDirectory}`);
70
+ // In full mode, we also write the raw witnesses in a more human-readable format.
71
+ await fs.writeFile(
72
+ path.join(resultsDirectory, 'witnesses.json'),
73
+ JSON.stringify(result.executionSteps.map(step => Object.fromEntries(step.witness))),
74
+ );
79
75
  }
76
+ logger.info(`Wrote private execution steps to ${resultsDirectory}`);
80
77
  }
@@ -232,8 +232,10 @@ export class CrossChainTestHarness {
232
232
  address: this.l1TokenManager.tokenAddress.toString(),
233
233
  client: this.walletClient,
234
234
  });
235
- await contract.write.mint([this.ethAccount.toString(), amount]);
236
- expect(await this.l1TokenManager.getL1TokenBalance(this.ethAccount.toString())).toEqual(amount);
235
+ const balanceBefore = await this.l1TokenManager.getL1TokenBalance(this.ethAccount.toString());
236
+ const hash = await contract.write.mint([this.ethAccount.toString(), amount]);
237
+ await this.publicClient.waitForTransactionReceipt({ hash });
238
+ expect(await this.l1TokenManager.getL1TokenBalance(this.ethAccount.toString())).toEqual(balanceBefore + amount);
237
239
  }
238
240
 
239
241
  getL1BalanceOf(address: EthAddress) {
@@ -73,7 +73,8 @@ export async function deployTestWalletWithTokens(
73
73
  fundedAccounts.map(a => bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(), undefined, logger)),
74
74
  );
75
75
 
76
- // Progress by 2 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
76
+ // Progress by 3 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
77
+ await advanceL2Block(node);
77
78
  await advanceL2Block(node);
78
79
  await advanceL2Block(node);
79
80