@aztec/end-to-end 0.86.0 → 0.87.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 (94) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.js +1 -1
  2. package/dest/bench/client_flows/config.d.ts +1 -1
  3. package/dest/bench/client_flows/config.d.ts.map +1 -1
  4. package/dest/bench/client_flows/config.js +22 -3
  5. package/dest/bench/client_flows/data_extractor.d.ts.map +1 -1
  6. package/dest/bench/client_flows/data_extractor.js +23 -12
  7. package/dest/bench/utils.d.ts +1 -1
  8. package/dest/bench/utils.d.ts.map +1 -1
  9. package/dest/bench/utils.js +9 -5
  10. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  12. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +1 -1
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +5 -2
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +8 -4
  16. package/dest/e2e_deploy_contract/deploy_test.d.ts +1 -1
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  18. package/dest/e2e_epochs/epochs_test.d.ts +13 -5
  19. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.js +41 -16
  21. package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
  22. package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
  23. package/dest/e2e_fees/bridging_race.notest.js +60 -0
  24. package/dest/e2e_fees/fees_test.d.ts +1 -1
  25. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  26. package/dest/e2e_fees/fees_test.js +15 -9
  27. package/dest/e2e_nested_contract/nested_contract_test.d.ts +2 -2
  28. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  29. package/dest/e2e_nested_contract/nested_contract_test.js +2 -2
  30. package/dest/e2e_p2p/p2p_network.d.ts +10 -214
  31. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  32. package/dest/e2e_p2p/p2p_network.js +20 -23
  33. package/dest/e2e_p2p/shared.d.ts +1 -1
  34. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  35. package/dest/e2e_p2p/shared.js +3 -7
  36. package/dest/e2e_prover/e2e_prover_test.d.ts.map +1 -1
  37. package/dest/e2e_prover/e2e_prover_test.js +2 -1
  38. package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
  39. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  40. package/dest/e2e_token_contract/token_contract_test.js +1 -1
  41. package/dest/fixtures/fixtures.d.ts +4 -6
  42. package/dest/fixtures/fixtures.d.ts.map +1 -1
  43. package/dest/fixtures/fixtures.js +2 -2
  44. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  45. package/dest/fixtures/l1_to_l2_messaging.d.ts +5 -1
  46. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  47. package/dest/fixtures/l1_to_l2_messaging.js +5 -4
  48. package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
  49. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  50. package/dest/fixtures/setup_p2p_test.d.ts +1 -2
  51. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  52. package/dest/fixtures/setup_p2p_test.js +3 -3
  53. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  54. package/dest/fixtures/snapshot_manager.js +6 -2
  55. package/dest/fixtures/utils.d.ts +6 -6
  56. package/dest/fixtures/utils.d.ts.map +1 -1
  57. package/dest/fixtures/utils.js +64 -63
  58. package/dest/shared/capture_private_execution_steps.d.ts.map +1 -1
  59. package/dest/shared/capture_private_execution_steps.js +8 -4
  60. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  61. package/dest/shared/submit-transactions.d.ts.map +1 -1
  62. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  63. package/dest/shared/uniswap_l1_l2.js +1 -1
  64. package/dest/simulators/token_simulator.d.ts.map +1 -1
  65. package/dest/simulators/token_simulator.js +1 -1
  66. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  67. package/dest/spartan/utils.d.ts +0 -1
  68. package/dest/spartan/utils.d.ts.map +1 -1
  69. package/package.json +38 -37
  70. package/src/bench/client_flows/client_flows_benchmark.ts +1 -1
  71. package/src/bench/client_flows/config.ts +12 -4
  72. package/src/bench/client_flows/data_extractor.ts +40 -20
  73. package/src/bench/utils.ts +7 -3
  74. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +1 -1
  75. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +16 -5
  76. package/src/e2e_deploy_contract/deploy_test.ts +1 -1
  77. package/src/e2e_epochs/epochs_test.ts +51 -18
  78. package/src/e2e_fees/bridging_race.notest.ts +74 -0
  79. package/src/e2e_fees/fees_test.ts +24 -9
  80. package/src/e2e_nested_contract/nested_contract_test.ts +6 -3
  81. package/src/e2e_p2p/p2p_network.ts +27 -21
  82. package/src/e2e_p2p/shared.ts +4 -6
  83. package/src/e2e_prover/e2e_prover_test.ts +1 -0
  84. package/src/e2e_token_contract/token_contract_test.ts +1 -1
  85. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  86. package/src/fixtures/fixtures.ts +2 -2
  87. package/src/fixtures/l1_to_l2_messaging.ts +1 -1
  88. package/src/fixtures/setup_p2p_test.ts +3 -3
  89. package/src/fixtures/snapshot_manager.ts +2 -2
  90. package/src/fixtures/utils.ts +57 -66
  91. package/src/shared/capture_private_execution_steps.ts +9 -2
  92. package/src/shared/uniswap_l1_l2.ts +1 -1
  93. package/src/simulators/token_simulator.ts +0 -1
  94. package/src/spartan/setup_test_wallets.ts +6 -3
@@ -14,8 +14,8 @@ export const privateKey = Buffer.from('ac0974bec39a17e36ba4a6b4d238ff944bacb478c
14
14
  export const privateKey2 = Buffer.from('59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', 'hex');
15
15
 
16
16
  /// Common errors
17
- export const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with overflow 'self - other'";
18
- export const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow 'self + other'";
17
+ export const U128_UNDERFLOW_ERROR = 'Assertion failed: attempt to subtract with overflow';
18
+ export const U128_OVERFLOW_ERROR = 'Assertion failed: attempt to add with overflow';
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
21
  export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
@@ -46,5 +46,5 @@ export async function sendL1ToL2Message(
46
46
  const receivedMsgHash = topics.args.hash;
47
47
  const receivedGlobalLeafIndex = topics.args.index;
48
48
 
49
- return [Fr.fromHexString(receivedMsgHash), new Fr(receivedGlobalLeafIndex)];
49
+ return { msgHash: Fr.fromHexString(receivedMsgHash), globalLeafIndex: new Fr(receivedGlobalLeafIndex), txReceipt };
50
50
  }
@@ -15,9 +15,9 @@ import { TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
15
15
  import { getPrivateKeyFromIndex } from './utils.js';
16
16
  import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
17
17
 
18
- // Setup snapshots will create a node with index 0, so all of our loops here
19
- // need to start from 1 to avoid running validators with the same key
20
- export const PROPOSER_PRIVATE_KEYS_START_INDEX = 1;
18
+ // Setup snapshots will create a node with index 0, and run extra bootstrap with
19
+ // index 1, so all of our loops here need to start from 2 to avoid running validators with the same key
20
+ export const PROPOSER_PRIVATE_KEYS_START_INDEX = 2;
21
21
  export const ATTESTER_PRIVATE_KEYS_START_INDEX = 1001;
22
22
 
23
23
  export interface NodeContext {
@@ -436,8 +436,8 @@ async function setupFromFresh(
436
436
  proverNode = await createAndSyncProverNode(
437
437
  `0x${proverNodePrivateKey!.toString('hex')}`,
438
438
  aztecNodeConfig,
439
+ { dataDirectory: path.join(directoryToCleanup, randomBytes(8).toString('hex')) },
439
440
  aztecNode,
440
- path.join(directoryToCleanup, randomBytes(8).toString('hex')),
441
441
  prefilledPublicData,
442
442
  );
443
443
  }
@@ -560,8 +560,8 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
560
560
  proverNode = await createAndSyncProverNode(
561
561
  proverNodePrivateKeyHex,
562
562
  aztecNodeConfig,
563
+ { dataDirectory: path.join(directoryToCleanup, randomBytes(8).toString('hex')) },
563
564
  aztecNode,
564
- path.join(directoryToCleanup, randomBytes(8).toString('hex')),
565
565
  prefilledPublicData,
566
566
  );
567
567
  }
@@ -16,7 +16,6 @@ import {
16
16
  type ContractMethod,
17
17
  type Logger,
18
18
  type PXE,
19
- SignerlessWallet,
20
19
  type Wallet,
21
20
  createAztecNodeClient,
22
21
  createLogger,
@@ -25,12 +24,10 @@ import {
25
24
  waitForPXE,
26
25
  } from '@aztec/aztec.js';
27
26
  import { deployInstance, registerContractClass } from '@aztec/aztec.js/deployment';
28
- import { SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee/testing';
29
27
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec.js/testing';
30
28
  import { createBlobSinkClient } from '@aztec/blob-sink/client';
31
29
  import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
32
30
  import { GENESIS_ARCHIVE_ROOT, SPONSORED_FPC_SALT } from '@aztec/constants';
33
- import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
34
31
  import {
35
32
  type DeployL1ContractsArgs,
36
33
  type DeployL1ContractsReturnType,
@@ -46,8 +43,10 @@ import { DelayedTxUtils, EthCheatCodesWithState, startAnvil } from '@aztec/ether
46
43
  import { randomBytes } from '@aztec/foundation/crypto';
47
44
  import { EthAddress } from '@aztec/foundation/eth-address';
48
45
  import { Fr } from '@aztec/foundation/fields';
46
+ import { withLogNameSuffix } from '@aztec/foundation/log';
49
47
  import { retryUntil } from '@aztec/foundation/retry';
50
48
  import { TestDateProvider } from '@aztec/foundation/timer';
49
+ import type { DataStoreConfig } from '@aztec/kv-store/config';
51
50
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
52
51
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
53
52
  import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
@@ -294,6 +293,8 @@ export type SetupOptions = {
294
293
  telemetryConfig?: Partial<TelemetryClientConfig> & { benchmark?: boolean };
295
294
  /** Public data that will be inserted in the tree in genesis */
296
295
  genesisPublicData?: PublicDataTreeLeaf[];
296
+ /** Specific config for the prover node, if set. */
297
+ proverNodeConfig?: Partial<ProverNodeConfig>;
297
298
  } & Partial<AztecNodeConfig>;
298
299
 
299
300
  /** Context for an end-to-end test as returned by the `setup` function */
@@ -532,11 +533,14 @@ export async function setup(
532
533
  logger.verbose('Creating and syncing a simulated prover node...');
533
534
  const proverNodePrivateKey = getPrivateKeyFromIndex(2);
534
535
  const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
536
+ const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
537
+ const proverNodeConfig = { ...config.proverNodeConfig, dataDirectory: proverNodeDataDirectory };
535
538
  proverNode = await createAndSyncProverNode(
536
539
  proverNodePrivateKeyHex,
537
540
  config,
541
+ proverNodeConfig,
538
542
  aztecNode,
539
- path.join(directoryToCleanup, randomBytes(8).toString('hex')),
543
+ prefilledPublicData,
540
544
  );
541
545
  }
542
546
 
@@ -745,22 +749,13 @@ export async function getSponsoredFPCAddress() {
745
749
  * Deploy a sponsored FPC contract to a running instance.
746
750
  */
747
751
  export async function setupSponsoredFPC(pxe: PXE) {
748
- const { l1ChainId: chainId, rollupVersion } = await pxe.getNodeInfo();
749
- const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId, rollupVersion));
750
-
751
- // Make the contract pay for the deployment fee itself
752
- const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
753
-
754
- const deployed = await SponsoredFPCContract.deploy(deployer)
755
- .send({
756
- contractAddressSalt: new Fr(SPONSORED_FPC_SALT),
757
- universalDeploy: true,
758
- fee: { paymentMethod },
759
- })
760
- .deployed();
761
-
762
- getLogger().info(`SponsoredFPC: ${deployed.address}`);
763
- return deployed;
752
+ const instance = await getContractInstanceFromDeployParams(SponsoredFPCContract.artifact, {
753
+ salt: new Fr(SPONSORED_FPC_SALT),
754
+ });
755
+
756
+ await pxe.registerContract({ instance, artifact: SponsoredFPCContract.artifact });
757
+ getLogger().info(`SponsoredFPC: ${instance.address}`);
758
+ return instance;
764
759
  }
765
760
 
766
761
  export async function waitForProvenChain(node: AztecNode, targetBlock?: number, timeoutSec = 60, intervalSec = 1) {
@@ -774,60 +769,56 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: number,
774
769
  );
775
770
  }
776
771
 
777
- export async function createAndSyncProverNode(
772
+ export function createAndSyncProverNode(
778
773
  proverNodePrivateKey: `0x${string}`,
779
774
  aztecNodeConfig: AztecNodeConfig,
775
+ proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'>,
780
776
  aztecNode: AztecNode,
781
- dataDirectory: string,
782
777
  prefilledPublicData: PublicDataTreeLeaf[] = [],
783
778
  ) {
784
- // Disable stopping the aztec node as the prover coordination test will kill it otherwise
785
- // This is only required when stopping the prover node for testing
786
- const aztecNodeWithoutStop = {
787
- getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
788
- getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
789
- stop: () => Promise.resolve(),
790
- };
791
-
792
- const blobSinkClient = createBlobSinkClient(aztecNodeConfig, {
793
- logger: createLogger('prover-node:blob-sink:client'),
794
- });
795
- // Creating temp store and archiver for simulated prover node
796
- const archiverConfig = { ...aztecNodeConfig, dataDirectory };
797
- const archiver = await createArchiver(archiverConfig, blobSinkClient, {
798
- blockUntilSync: true,
799
- });
779
+ return withLogNameSuffix('prover-node', async () => {
780
+ // Disable stopping the aztec node as the prover coordination test will kill it otherwise
781
+ // This is only required when stopping the prover node for testing
782
+ const aztecNodeTxProvider = {
783
+ getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
784
+ getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
785
+ stop: () => Promise.resolve(),
786
+ };
800
787
 
801
- // Prover node config is for simulated proofs
802
- const proverConfig: ProverNodeConfig = {
803
- ...aztecNodeConfig,
804
- proverCoordinationNodeUrls: [],
805
- dataDirectory: undefined,
806
- realProofs: false,
807
- proverAgentCount: 2,
808
- publisherPrivateKey: proverNodePrivateKey,
809
- proverNodeMaxPendingJobs: 10,
810
- proverNodeMaxParallelBlocksPerEpoch: 32,
811
- proverNodePollingIntervalMs: 200,
812
- txGatheringIntervalMs: 1000,
813
- txGatheringBatchSize: 10,
814
- txGatheringMaxParallelRequestsPerNode: 10,
815
- };
788
+ const blobSinkClient = createBlobSinkClient(aztecNodeConfig);
789
+
790
+ // Creating temp store and archiver for simulated prover node
791
+ const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
792
+ const archiver = await createArchiver(archiverConfig, blobSinkClient, { blockUntilSync: true });
793
+
794
+ // Prover node config is for simulated proofs
795
+ const proverConfig: ProverNodeConfig = {
796
+ ...aztecNodeConfig,
797
+ proverCoordinationNodeUrls: [],
798
+ realProofs: false,
799
+ proverAgentCount: 2,
800
+ publisherPrivateKey: proverNodePrivateKey,
801
+ proverNodeMaxPendingJobs: 10,
802
+ proverNodeMaxParallelBlocksPerEpoch: 32,
803
+ proverNodePollingIntervalMs: 200,
804
+ txGatheringIntervalMs: 1000,
805
+ txGatheringBatchSize: 10,
806
+ txGatheringMaxParallelRequestsPerNode: 10,
807
+ proverNodeFailedEpochStore: undefined,
808
+ ...proverNodeConfig,
809
+ };
816
810
 
817
- const l1TxUtils = createDelayedL1TxUtils(aztecNodeConfig, proverNodePrivateKey, 'prover-node');
811
+ const l1TxUtils = createDelayedL1TxUtils(aztecNodeConfig, proverNodePrivateKey, 'prover-node');
818
812
 
819
- const proverNode = await createProverNode(
820
- proverConfig,
821
- {
822
- aztecNodeTxProvider: aztecNodeWithoutStop,
823
- archiver: archiver as Archiver,
824
- l1TxUtils,
825
- },
826
- { prefilledPublicData },
827
- );
828
- getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
829
- await proverNode.start();
830
- return proverNode;
813
+ const proverNode = await createProverNode(
814
+ proverConfig,
815
+ { aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
816
+ { prefilledPublicData },
817
+ );
818
+ getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
819
+ await proverNode.start();
820
+ return proverNode;
821
+ });
831
822
  }
832
823
 
833
824
  function createDelayedL1TxUtils(aztecNodeConfig: AztecNodeConfig, privateKey: `0x${string}`, logName: string) {
@@ -44,9 +44,16 @@ export async function capturePrivateExecutionStepsIfEnvSet(
44
44
  if (profileMode === 'full') {
45
45
  // If we have gate counts, write the steps in human-readable format.
46
46
  await fs.writeFile(
47
- path.join(resultsDirectory, 'steps.json'),
47
+ path.join(resultsDirectory, 'profile.json'),
48
48
  JSON.stringify(
49
- result.executionSteps.map(step => ({ fnName: step.functionName, gateCount: step.gateCount })),
49
+ {
50
+ timings: result.timings,
51
+ steps: result.executionSteps.map(step => ({
52
+ fnName: step.functionName,
53
+ gateCount: step.gateCount,
54
+ timings: step.timings,
55
+ })),
56
+ },
50
57
  null,
51
58
  2,
52
59
  ),
@@ -625,7 +625,7 @@ export const uniswapL1L2TestSuite = (
625
625
  Fr.random(),
626
626
  ownerEthAddress,
627
627
  )
628
- .prove(),
628
+ .simulate(),
629
629
  ).rejects.toThrow(`Unknown auth witness for message hash ${expectedMessageHash.toString()}`);
630
630
  });
631
631
 
@@ -1,4 +1,3 @@
1
- /* eslint-disable jsdoc/require-jsdoc */
2
1
  import { type AztecAddress, BatchCall, type Logger, type Wallet } from '@aztec/aztec.js';
3
2
  import type { TokenContract } from '@aztec/noir-contracts.js/Token';
4
3
 
@@ -170,9 +170,12 @@ export async function performTransfers({
170
170
  for (let i = 0; i < rounds; i++) {
171
171
  const interactions = await Promise.all(
172
172
  testWallets.wallets.map(async w =>
173
- (
174
- await TokenContract.at(testWallets.tokenAddress, w)
175
- ).methods.transfer_in_public(w.getAddress(), recipient, transferAmount, 0),
173
+ (await TokenContract.at(testWallets.tokenAddress, w)).methods.transfer_in_public(
174
+ w.getAddress(),
175
+ recipient,
176
+ transferAmount,
177
+ 0,
178
+ ),
176
179
  ),
177
180
  );
178
181