@aztec/end-to-end 0.0.1-commit.0c875d939 → 0.0.1-commit.10bd49492

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 (134) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +1 -1
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +16 -8
  4. package/dest/bench/utils.d.ts +1 -1
  5. package/dest/bench/utils.d.ts.map +1 -1
  6. package/dest/bench/utils.js +6 -3
  7. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
  8. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  9. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +14 -14
  10. package/dest/e2e_epochs/epochs_test.d.ts +9 -7
  11. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  12. package/dest/e2e_epochs/epochs_test.js +55 -35
  13. package/dest/e2e_fees/fees_test.d.ts +1 -1
  14. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  15. package/dest/e2e_fees/fees_test.js +13 -6
  16. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  17. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  18. package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
  19. package/dest/e2e_p2p/p2p_network.d.ts +4 -3
  20. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  21. package/dest/e2e_p2p/p2p_network.js +24 -7
  22. package/dest/e2e_p2p/reqresp/utils.d.ts +3 -3
  23. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
  24. package/dest/e2e_p2p/reqresp/utils.js +45 -8
  25. package/dest/e2e_p2p/shared.d.ts +21 -1
  26. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  27. package/dest/e2e_p2p/shared.js +33 -2
  28. package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
  29. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  30. package/dest/e2e_token_contract/token_contract_test.js +11 -11
  31. package/dest/fixtures/authwit_proxy.d.ts +3 -3
  32. package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
  33. package/dest/fixtures/e2e_prover_test.d.ts +3 -3
  34. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  35. package/dest/fixtures/e2e_prover_test.js +33 -40
  36. package/dest/fixtures/elu_monitor.d.ts +21 -0
  37. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  38. package/dest/fixtures/elu_monitor.js +102 -0
  39. package/dest/fixtures/fixtures.d.ts +5 -1
  40. package/dest/fixtures/fixtures.d.ts.map +1 -1
  41. package/dest/fixtures/fixtures.js +6 -0
  42. package/dest/fixtures/setup.d.ts +30 -9
  43. package/dest/fixtures/setup.d.ts.map +1 -1
  44. package/dest/fixtures/setup.js +51 -81
  45. package/dest/fixtures/setup_p2p_test.d.ts +6 -3
  46. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  47. package/dest/fixtures/setup_p2p_test.js +12 -9
  48. package/dest/fixtures/token_utils.d.ts +2 -2
  49. package/dest/fixtures/token_utils.d.ts.map +1 -1
  50. package/dest/fixtures/token_utils.js +5 -4
  51. package/dest/shared/cross_chain_test_harness.d.ts +1 -1
  52. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  53. package/dest/shared/cross_chain_test_harness.js +13 -13
  54. package/dest/shared/gas_portal_test_harness.js +2 -2
  55. package/dest/shared/jest_setup.js +41 -1
  56. package/dest/shared/submit-transactions.js +1 -1
  57. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  58. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  59. package/dest/shared/uniswap_l1_l2.js +14 -17
  60. package/dest/simulators/lending_simulator.d.ts +1 -1
  61. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  62. package/dest/simulators/lending_simulator.js +2 -2
  63. package/dest/simulators/token_simulator.d.ts +1 -1
  64. package/dest/simulators/token_simulator.d.ts.map +1 -1
  65. package/dest/simulators/token_simulator.js +2 -2
  66. package/dest/spartan/setup_test_wallets.d.ts +11 -2
  67. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  68. package/dest/spartan/setup_test_wallets.js +51 -10
  69. package/dest/spartan/tx_metrics.js +1 -1
  70. package/dest/spartan/utils/bot.d.ts +3 -2
  71. package/dest/spartan/utils/bot.d.ts.map +1 -1
  72. package/dest/spartan/utils/bot.js +2 -1
  73. package/dest/spartan/utils/config.d.ts +7 -1
  74. package/dest/spartan/utils/config.d.ts.map +1 -1
  75. package/dest/spartan/utils/config.js +3 -1
  76. package/dest/spartan/utils/index.d.ts +4 -2
  77. package/dest/spartan/utils/index.d.ts.map +1 -1
  78. package/dest/spartan/utils/index.js +5 -1
  79. package/dest/spartan/utils/k8s.d.ts +3 -1
  80. package/dest/spartan/utils/k8s.d.ts.map +1 -1
  81. package/dest/spartan/utils/k8s.js +6 -0
  82. package/dest/spartan/utils/nodes.d.ts +4 -5
  83. package/dest/spartan/utils/nodes.d.ts.map +1 -1
  84. package/dest/spartan/utils/nodes.js +9 -9
  85. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  86. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  87. package/dest/spartan/utils/pod_logs.js +74 -0
  88. package/dest/test-wallet/test_wallet.js +1 -1
  89. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  90. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  91. package/dest/test-wallet/wallet_worker_script.js +48 -0
  92. package/dest/test-wallet/worker_wallet.d.ts +52 -0
  93. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  94. package/dest/test-wallet/worker_wallet.js +151 -0
  95. package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
  96. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  97. package/dest/test-wallet/worker_wallet_schema.js +10 -0
  98. package/package.json +43 -44
  99. package/src/bench/client_flows/client_flows_benchmark.ts +38 -30
  100. package/src/bench/utils.ts +7 -2
  101. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +18 -14
  102. package/src/e2e_epochs/epochs_test.ts +67 -66
  103. package/src/e2e_fees/fees_test.ts +13 -6
  104. package/src/e2e_nested_contract/nested_contract_test.ts +6 -4
  105. package/src/e2e_p2p/p2p_network.ts +31 -5
  106. package/src/e2e_p2p/reqresp/utils.ts +57 -8
  107. package/src/e2e_p2p/shared.ts +55 -2
  108. package/src/e2e_token_contract/token_contract_test.ts +16 -8
  109. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  110. package/src/fixtures/e2e_prover_test.ts +36 -40
  111. package/src/fixtures/elu_monitor.ts +126 -0
  112. package/src/fixtures/fixtures.ts +10 -0
  113. package/src/fixtures/setup.ts +74 -110
  114. package/src/fixtures/setup_p2p_test.ts +9 -17
  115. package/src/fixtures/token_utils.ts +6 -3
  116. package/src/shared/cross_chain_test_harness.ts +13 -9
  117. package/src/shared/gas_portal_test_harness.ts +1 -1
  118. package/src/shared/jest_setup.ts +51 -1
  119. package/src/shared/submit-transactions.ts +1 -1
  120. package/src/shared/uniswap_l1_l2.ts +35 -28
  121. package/src/simulators/lending_simulator.ts +4 -2
  122. package/src/simulators/token_simulator.ts +6 -2
  123. package/src/spartan/setup_test_wallets.ts +99 -16
  124. package/src/spartan/tx_metrics.ts +1 -1
  125. package/src/spartan/utils/bot.ts +3 -0
  126. package/src/spartan/utils/config.ts +2 -0
  127. package/src/spartan/utils/index.ts +7 -0
  128. package/src/spartan/utils/k8s.ts +8 -0
  129. package/src/spartan/utils/nodes.ts +15 -10
  130. package/src/spartan/utils/pod_logs.ts +99 -0
  131. package/src/test-wallet/test_wallet.ts +1 -1
  132. package/src/test-wallet/wallet_worker_script.ts +60 -0
  133. package/src/test-wallet/worker_wallet.ts +213 -0
  134. package/src/test-wallet/worker_wallet_schema.ts +13 -0
@@ -1,6 +1,5 @@
1
1
  import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
2
  import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
3
- import { type Archiver, createArchiver } from '@aztec/archiver';
4
3
  import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
5
4
  import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
6
5
  import {
@@ -16,7 +15,6 @@ import { type Logger, createLogger } from '@aztec/aztec.js/log';
16
15
  import type { AztecNode } from '@aztec/aztec.js/node';
17
16
  import type { Wallet } from '@aztec/aztec.js/wallet';
18
17
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
19
- import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
20
18
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
21
19
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
22
20
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -30,13 +28,9 @@ import {
30
28
  type ZKPassportArgs,
31
29
  deployAztecL1Contracts,
32
30
  } from '@aztec/ethereum/deploy-aztec-l1-contracts';
33
- import {
34
- DelayedTxUtils,
35
- EthCheatCodes,
36
- EthCheatCodesWithState,
37
- createDelayedL1TxUtilsFromViemWallet,
38
- startAnvil,
39
- } from '@aztec/ethereum/test';
31
+ import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
32
+ import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
33
+ import type { Anvil } from '@aztec/ethereum/test';
40
34
  import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
41
35
  import { SecretValue } from '@aztec/foundation/config';
42
36
  import { randomBytes } from '@aztec/foundation/crypto/random';
@@ -45,20 +39,17 @@ import { withLoggerBindings } from '@aztec/foundation/log/server';
45
39
  import { retryUntil } from '@aztec/foundation/retry';
46
40
  import { sleep } from '@aztec/foundation/sleep';
47
41
  import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
48
- import type { DataStoreConfig } from '@aztec/kv-store/config';
49
42
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
50
43
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
51
44
  import type { P2PClientDeps } from '@aztec/p2p';
52
45
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
53
46
  import { protocolContractsHash } from '@aztec/protocol-contracts';
54
- import { type ProverNode, type ProverNodeConfig, type ProverNodeDeps, createProverNode } from '@aztec/prover-node';
47
+ import type { ProverNodeConfig } from '@aztec/prover-node';
55
48
  import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
56
49
  import type { SequencerClient } from '@aztec/sequencer-client';
57
- import type { TestSequencerClient } from '@aztec/sequencer-client/test';
58
50
  import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
59
51
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
60
52
  import { tryStop } from '@aztec/stdlib/interfaces/server';
61
- import type { P2PClientType } from '@aztec/stdlib/p2p';
62
53
  import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
63
54
  import {
64
55
  type TelemetryClient,
@@ -70,7 +61,6 @@ import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
70
61
  import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
71
62
  import { getGenesisValues } from '@aztec/world-state/testing';
72
63
 
73
- import type { Anvil } from '@viem/anvil';
74
64
  import fs from 'fs/promises';
75
65
  import { tmpdir } from 'os';
76
66
  import path from 'path';
@@ -195,6 +185,11 @@ export type SetupOptions = {
195
185
  anvilAccounts?: number;
196
186
  /** Port to start anvil (defaults to 8545) */
197
187
  anvilPort?: number;
188
+ /**
189
+ * Number of slots per epoch for Anvil's finality simulation.
190
+ * Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
191
+ */
192
+ anvilSlotsInAnEpoch?: number;
198
193
  /** Key to use for publishing L1 contracts */
199
194
  l1PublisherKey?: SecretValue<`0x${string}`>;
200
195
  /** ZkPassport configuration (domain, scope, mock verifier) */
@@ -219,8 +214,8 @@ export type EndToEndContext = {
219
214
  aztecNodeService: AztecNodeService;
220
215
  /** Client to the Aztec Node admin interface. */
221
216
  aztecNodeAdmin: AztecNodeAdmin;
222
- /** The prover node service (only set if startProverNode is true) */
223
- proverNode: ProverNode | undefined;
217
+ /** The aztec node running the prover node subsystem (only set if startProverNode is true). */
218
+ proverNode: AztecNodeService | undefined;
224
219
  /** A client to the sequencer service. */
225
220
  sequencer: SequencerClient | undefined;
226
221
  /** Return values from deployAztecL1Contracts function. */
@@ -249,6 +244,10 @@ export type EndToEndContext = {
249
244
  telemetryClient: TelemetryClient;
250
245
  /** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
251
246
  mockGossipSubNetwork: MockGossipSubNetwork | undefined;
247
+ /** Delayer for sequencer L1 txs (only when enableDelayer is true). */
248
+ sequencerDelayer: Delayer | undefined;
249
+ /** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
250
+ proverDelayer: Delayer | undefined;
252
251
  /** Prefilled public data used for setting up nodes. */
253
252
  prefilledPublicData: PublicDataTreeLeaf[] | undefined;
254
253
  /** ACVM config (only set if running locally). */
@@ -288,6 +287,8 @@ export async function setup(
288
287
  config.realProofs = !!opts.realProofs;
289
288
  // Only enforce the time table if requested
290
289
  config.enforceTimeTable = !!opts.enforceTimeTable;
290
+ // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
291
+ config.enableDelayer = true;
291
292
  config.listenAddress = '127.0.0.1';
292
293
 
293
294
  config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
@@ -309,6 +310,7 @@ export async function setup(
309
310
  l1BlockTime: opts.ethereumSlotDuration,
310
311
  accounts: opts.anvilAccounts,
311
312
  port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
313
+ slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
312
314
  });
313
315
  anvil = res.anvil;
314
316
  config.l1RpcUrls = [res.rpcUrl];
@@ -339,11 +341,11 @@ export async function setup(
339
341
  publisherPrivKeyHex = opts.l1PublisherKey.getValue();
340
342
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
341
343
  } else if (
342
- config.publisherPrivateKeys &&
343
- config.publisherPrivateKeys.length > 0 &&
344
- config.publisherPrivateKeys[0].getValue() != NULL_KEY
344
+ config.sequencerPublisherPrivateKeys &&
345
+ config.sequencerPublisherPrivateKeys.length > 0 &&
346
+ config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
345
347
  ) {
346
- publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
348
+ publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
347
349
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
348
350
  } else if (!MNEMONIC) {
349
351
  throw new Error(`Mnemonic not provided and no publisher private key`);
@@ -352,7 +354,7 @@ export async function setup(
352
354
  const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
353
355
  const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
354
356
  publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
355
- config.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
357
+ config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
356
358
  }
357
359
 
358
360
  if (config.coinbase === undefined) {
@@ -459,7 +461,7 @@ export async function setup(
459
461
  }
460
462
 
461
463
  let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
462
- let p2pClientDeps: P2PClientDeps<P2PClientType.Full> | undefined = undefined;
464
+ let p2pClientDeps: P2PClientDeps | undefined = undefined;
463
465
 
464
466
  if (opts.mockGossipSubNetwork) {
465
467
  mockGossipSubNetwork = new MockGossipSubNetwork();
@@ -499,36 +501,33 @@ export async function setup(
499
501
  );
500
502
  const sequencerClient = aztecNodeService.getSequencer();
501
503
 
502
- if (sequencerClient) {
503
- const publisher = (sequencerClient as TestSequencerClient).sequencer.publisher;
504
- publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
505
- }
506
-
507
- let proverNode: ProverNode | undefined = undefined;
504
+ let proverNode: AztecNodeService | undefined = undefined;
508
505
  if (opts.startProverNode) {
509
506
  logger.verbose('Creating and syncing a simulated prover node...');
510
507
  const proverNodePrivateKey = getPrivateKeyFromIndex(2);
511
508
  const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
512
509
  const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
513
- const proverNodeConfig = {
514
- ...config.proverNodeConfig,
515
- dataDirectory: proverNodeDataDirectory,
516
- p2pEnabled: !!mockGossipSubNetwork,
510
+
511
+ const p2pClientDeps: Partial<P2PClientDeps> = {
512
+ p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
513
+ rpcTxProviders: [aztecNodeService],
517
514
  };
518
- proverNode = await createAndSyncProverNode(
515
+
516
+ ({ proverNode } = await createAndSyncProverNode(
519
517
  proverNodePrivateKeyHex,
520
518
  config,
521
- proverNodeConfig,
522
- aztecNodeService,
523
- prefilledPublicData,
524
519
  {
525
- p2pClientDeps: mockGossipSubNetwork
526
- ? { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) }
527
- : undefined,
520
+ ...config.proverNodeConfig,
521
+ dataDirectory: proverNodeDataDirectory,
528
522
  },
529
- );
523
+ { dateProvider, p2pClientDeps, telemetry: telemetryClient },
524
+ { prefilledPublicData },
525
+ ));
530
526
  }
531
527
 
528
+ const sequencerDelayer = sequencerClient?.getDelayer();
529
+ const proverDelayer = proverNode?.getProverNode()?.getDelayer();
530
+
532
531
  logger.verbose('Creating a pxe...');
533
532
  const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
534
533
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
@@ -629,6 +628,8 @@ export async function setup(
629
628
  mockGossipSubNetwork,
630
629
  prefilledPublicData,
631
630
  proverNode,
631
+ sequencerDelayer,
632
+ proverDelayer,
632
633
  sequencer: sequencerClient,
633
634
  teardown,
634
635
  telemetryClient,
@@ -712,81 +713,42 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
712
713
  );
713
714
  }
714
715
 
716
+ /**
717
+ * Creates an AztecNodeService with the prover node enabled as a subsystem.
718
+ * Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
719
+ */
715
720
  export function createAndSyncProverNode(
716
721
  proverNodePrivateKey: `0x${string}`,
717
- aztecNodeConfig: AztecNodeConfig,
718
- proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'> & { dontStart?: boolean },
719
- aztecNode: AztecNode | undefined,
720
- prefilledPublicData: PublicDataTreeLeaf[] = [],
721
- proverNodeDeps: ProverNodeDeps = {},
722
- ) {
722
+ baseConfig: AztecNodeConfig,
723
+ configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
724
+ deps: {
725
+ telemetry?: TelemetryClient;
726
+ dateProvider: DateProvider;
727
+ p2pClientDeps?: P2PClientDeps;
728
+ },
729
+ options: { prefilledPublicData: PublicDataTreeLeaf[]; dontStart?: boolean },
730
+ ): Promise<{ proverNode: AztecNodeService }> {
723
731
  return withLoggerBindings({ actor: 'prover-0' }, async () => {
724
- const aztecNodeTxProvider = aztecNode && {
725
- getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
726
- getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
727
- stop: () => Promise.resolve(),
728
- };
729
-
730
- const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('blob-client:prover-node'));
731
-
732
- const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
733
- const archiver = await createArchiver(
734
- archiverConfig,
735
- { blobClient, dateProvider: proverNodeDeps.dateProvider },
736
- { blockUntilSync: true },
737
- );
738
-
739
- const proverConfig: ProverNodeConfig = {
740
- ...aztecNodeConfig,
741
- txCollectionNodeRpcUrls: [],
742
- realProofs: false,
743
- proverAgentCount: 2,
744
- publisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
745
- proverNodeMaxPendingJobs: 10,
746
- proverNodeMaxParallelBlocksPerEpoch: 32,
747
- proverNodePollingIntervalMs: 200,
748
- txGatheringIntervalMs: 1000,
749
- txGatheringBatchSize: 10,
750
- txGatheringMaxParallelRequestsPerNode: 10,
751
- txGatheringTimeoutMs: 24_000,
752
- proverNodeFailedEpochStore: undefined,
753
- proverId: EthAddress.fromNumber(1),
754
- proverNodeEpochProvingDelayMs: undefined,
755
- ...proverNodeConfig,
756
- };
757
-
758
- const l1TxUtils = createDelayedL1TxUtils(
759
- aztecNodeConfig,
760
- proverNodePrivateKey,
761
- 'prover-node',
762
- proverNodeDeps.dateProvider,
732
+ const proverNode = await AztecNodeService.createAndSync(
733
+ {
734
+ ...baseConfig,
735
+ ...configOverrides,
736
+ p2pPort: 0,
737
+ enableProverNode: true,
738
+ disableValidator: true,
739
+ proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
740
+ },
741
+ deps,
742
+ { ...options, dontStartProverNode: options.dontStart },
763
743
  );
764
744
 
765
- const proverNode = await createProverNode(
766
- proverConfig,
767
- { ...proverNodeDeps, aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
768
- { prefilledPublicData },
769
- );
770
- getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
771
- if (!proverNodeConfig.dontStart) {
772
- await proverNode.start();
745
+ if (!proverNode.getProverNode()) {
746
+ throw new Error('Prover node subsystem was not created despite enableProverNode being set');
773
747
  }
774
- return proverNode;
775
- });
776
- }
777
-
778
- function createDelayedL1TxUtils(
779
- aztecNodeConfig: AztecNodeConfig,
780
- privateKey: `0x${string}`,
781
- logName: string,
782
- dateProvider?: DateProvider,
783
- ) {
784
- const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
785
748
 
786
- const log = createLogger(logName);
787
- const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
788
- l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
789
- return l1TxUtils;
749
+ getLogger().info(`Created and synced prover node`);
750
+ return { proverNode };
751
+ });
790
752
  }
791
753
 
792
754
  export type BalancesFn = ReturnType<typeof getBalancesFn>;
@@ -797,7 +759,9 @@ export function getBalancesFn(
797
759
  ): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
798
760
  const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
799
761
  const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
800
- const b = await Promise.all(addresses.map(address => method(address).simulate({ from: address })));
762
+ const b = await Promise.all(
763
+ addresses.map(async address => (await method(address).simulate({ from: address })).result),
764
+ );
801
765
  const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
802
766
  logger.verbose(debugString);
803
767
  return b;
@@ -915,7 +879,7 @@ export async function publicDeployAccounts(
915
879
 
916
880
  const batch = new BatchCall(wallet, calls);
917
881
 
918
- const txReceipt = await batch.send({ from: accountsToDeploy[0] });
882
+ const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
919
883
  if (waitUntilProven) {
920
884
  if (!node) {
921
885
  throw new Error('Need to provide an AztecNode to wait for proven.');
@@ -7,7 +7,6 @@ import { SecretValue } from '@aztec/foundation/config';
7
7
  import { withLoggerBindings } from '@aztec/foundation/log/server';
8
8
  import { bufferToHex } from '@aztec/foundation/string';
9
9
  import type { DateProvider } from '@aztec/foundation/timer';
10
- import type { ProverNodeConfig, ProverNodeDeps } from '@aztec/prover-node';
11
10
  import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
12
11
 
13
12
  import getPort from 'get-port';
@@ -131,7 +130,7 @@ export async function createNonValidatorNode(
131
130
  ...p2pConfig,
132
131
  disableValidator: true,
133
132
  validatorPrivateKeys: undefined,
134
- publisherPrivateKeys: [],
133
+ sequencerPublisherPrivateKeys: [],
135
134
  };
136
135
  const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
137
136
  return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, { prefilledPublicData });
@@ -143,31 +142,24 @@ export async function createProverNode(
143
142
  tcpPort: number,
144
143
  bootstrapNode: string | undefined,
145
144
  addressIndex: number,
146
- proverNodeDeps: ProverNodeDeps & Required<Pick<ProverNodeDeps, 'dateProvider'>>,
145
+ deps: { dateProvider: DateProvider },
147
146
  prefilledPublicData?: PublicDataTreeLeaf[],
148
147
  dataDirectory?: string,
149
148
  metricsPort?: number,
150
- ) {
149
+ ): Promise<{ proverNode: AztecNodeService }> {
151
150
  const actorIndex = proverCounter++;
152
151
  return await withLoggerBindings({ actor: `prover-${actorIndex}` }, async () => {
153
152
  const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!;
154
153
  const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
155
154
 
156
- const proverConfig: Partial<ProverNodeConfig> = await createP2PConfig(
157
- config,
158
- bootstrapNode,
159
- tcpPort,
160
- dataDirectory,
161
- );
155
+ const p2pConfig = await createP2PConfig(config, bootstrapNode, tcpPort, dataDirectory);
162
156
 
163
- const aztecNodeRpcTxProvider = undefined;
164
157
  return await createAndSyncProverNode(
165
158
  bufferToHex(proverNodePrivateKey),
166
- config,
167
- { ...proverConfig, dataDirectory },
168
- aztecNodeRpcTxProvider,
169
- prefilledPublicData,
170
- { ...proverNodeDeps, telemetry },
159
+ { ...config, ...p2pConfig },
160
+ { dataDirectory },
161
+ { ...deps, telemetry },
162
+ { prefilledPublicData: prefilledPublicData ?? [] },
171
163
  );
172
164
  });
173
165
  }
@@ -215,7 +207,7 @@ export async function createValidatorConfig(
215
207
  ...config,
216
208
  ...p2pConfig,
217
209
  validatorPrivateKeys: new SecretValue(attesterPrivateKeys),
218
- publisherPrivateKeys: [new SecretValue(attesterPrivateKeys[0])],
210
+ sequencerPublisherPrivateKeys: [new SecretValue(attesterPrivateKeys[0])],
219
211
  };
220
212
 
221
213
  return nodeConfig;
@@ -6,7 +6,9 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
6
6
 
7
7
  export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
8
8
  logger.info(`Deploying Token contract...`);
9
- const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
9
+ const {
10
+ receipt: { contract, instance },
11
+ } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
10
12
  from: admin,
11
13
  wait: { returnReceipt: true },
12
14
  });
@@ -25,8 +27,9 @@ export async function mintTokensToPrivate(
25
27
  minter: AztecAddress,
26
28
  recipient: AztecAddress,
27
29
  amount: bigint,
30
+ additionalScopes?: AztecAddress[],
28
31
  ) {
29
- await token.methods.mint_to_private(recipient, amount).send({ from: minter });
32
+ await token.methods.mint_to_private(recipient, amount).send({ from: minter, additionalScopes });
30
33
  }
31
34
 
32
35
  export async function expectTokenBalance(
@@ -38,7 +41,7 @@ export async function expectTokenBalance(
38
41
  ) {
39
42
  // Then check the balance
40
43
  const contractWithWallet = TokenContract.at(token.address, wallet);
41
- const balance = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
44
+ const { result: balance } = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
42
45
  logger.info(`Account ${owner} balance: ${balance}`);
43
46
  expect(balance).toBe(expectedBalance);
44
47
  }
@@ -73,22 +73,26 @@ export async function deployAndInitializeTokenAndBridgeContracts(
73
73
  });
74
74
 
75
75
  // deploy l2 token
76
- const token = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18).send({ from: owner });
76
+ const { contract: token } = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18).send({
77
+ from: owner,
78
+ });
77
79
 
78
80
  // deploy l2 token bridge and attach to the portal
79
- const bridge = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress).send({ from: owner });
81
+ const { contract: bridge } = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress).send({
82
+ from: owner,
83
+ });
80
84
 
81
- if ((await token.methods.get_admin().simulate({ from: owner })) !== owner.toBigInt()) {
85
+ if ((await token.methods.get_admin().simulate({ from: owner })).result !== owner.toBigInt()) {
82
86
  throw new Error(`Token admin is not ${owner}`);
83
87
  }
84
88
 
85
- if (!(await bridge.methods.get_config().simulate({ from: owner })).token.equals(token.address)) {
89
+ if (!(await bridge.methods.get_config().simulate({ from: owner })).result.token.equals(token.address)) {
86
90
  throw new Error(`Bridge token is not ${token.address}`);
87
91
  }
88
92
 
89
93
  // make the bridge a minter on the token:
90
94
  await token.methods.set_minter(bridge.address, true).send({ from: owner });
91
- if ((await token.methods.is_minter(bridge.address).simulate({ from: owner })) === 1n) {
95
+ if ((await token.methods.is_minter(bridge.address).simulate({ from: owner })).result === 1n) {
92
96
  throw new Error(`Bridge is not a minter`);
93
97
  }
94
98
 
@@ -269,7 +273,7 @@ export class CrossChainTestHarness {
269
273
  authwitNonce: Fr = Fr.ZERO,
270
274
  authWitness: AuthWitness,
271
275
  ): Promise<TxReceipt> {
272
- const withdrawReceipt = await this.l2Bridge.methods
276
+ const { receipt: withdrawReceipt } = await this.l2Bridge.methods
273
277
  .exit_to_l1_private(this.l2Token.address, this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
274
278
  .send({ authWitnesses: [authWitness], from: this.ownerAddress });
275
279
 
@@ -277,7 +281,7 @@ export class CrossChainTestHarness {
277
281
  }
278
282
 
279
283
  async withdrawPublicFromAztecToL1(withdrawAmount: bigint, authwitNonce: Fr = Fr.ZERO): Promise<TxReceipt> {
280
- const withdrawReceipt = await this.l2Bridge.methods
284
+ const { receipt: withdrawReceipt } = await this.l2Bridge.methods
281
285
  .exit_to_l1_public(this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
282
286
  .send({ from: this.ownerAddress });
283
287
 
@@ -285,7 +289,7 @@ export class CrossChainTestHarness {
285
289
  }
286
290
 
287
291
  async getL2PrivateBalanceOf(owner: AztecAddress) {
288
- return await this.l2Token.methods.balance_of_private(owner).simulate({ from: owner });
292
+ return (await this.l2Token.methods.balance_of_private(owner).simulate({ from: owner })).result;
289
293
  }
290
294
 
291
295
  async expectPrivateBalanceOnL2(owner: AztecAddress, expectedBalance: bigint) {
@@ -295,7 +299,7 @@ export class CrossChainTestHarness {
295
299
  }
296
300
 
297
301
  async getL2PublicBalanceOf(owner: AztecAddress) {
298
- return await this.l2Token.methods.balance_of_public(owner).simulate({ from: this.ownerAddress });
302
+ return (await this.l2Token.methods.balance_of_public(owner).simulate({ from: this.ownerAddress })).result;
299
303
  }
300
304
 
301
305
  async expectPublicBalanceOnL2(owner: AztecAddress, expectedBalance: bigint) {
@@ -131,7 +131,7 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
131
131
  }
132
132
 
133
133
  async getL2PublicBalanceOf(owner: AztecAddress) {
134
- return await this.feeJuice.methods.balance_of_public(owner).simulate({ from: owner });
134
+ return (await this.feeJuice.methods.balance_of_public(owner).simulate({ from: owner })).result;
135
135
  }
136
136
 
137
137
  async expectPublicBalanceOnL2(owner: AztecAddress, expectedBalance: bigint) {
@@ -1,8 +1,19 @@
1
1
  import { createLogger } from '@aztec/aztec.js/log';
2
2
 
3
- import { beforeEach, expect } from '@jest/globals';
3
+ import { afterAll, afterEach, beforeEach, expect } from '@jest/globals';
4
+ import { readlinkSync } from 'fs';
4
5
  import { basename } from 'path';
5
6
 
7
+ import { EluMonitor } from '../fixtures/elu_monitor.js';
8
+
9
+ const eluMonitor = process.env.ELU_MONITOR_FILE
10
+ ? new EluMonitor(process.env.ELU_MONITOR_FILE, Number(process.env.ELU_MONITOR_INTERVAL_MS) || undefined)
11
+ : undefined;
12
+
13
+ if (eluMonitor) {
14
+ process.on('exit', () => eluMonitor.stop());
15
+ }
16
+
6
17
  beforeEach(() => {
7
18
  const { testPath, currentTestName } = expect.getState();
8
19
  if (!testPath || !currentTestName) {
@@ -10,4 +21,43 @@ beforeEach(() => {
10
21
  }
11
22
  const logger = createLogger(`e2e:${basename(testPath).replace('.test.ts', '')}`);
12
23
  logger.info(`Running test: ${currentTestName}`);
24
+ eluMonitor?.startTest(currentTestName);
25
+ });
26
+
27
+ afterEach(() => {
28
+ eluMonitor?.stopTest();
29
+ });
30
+
31
+ // Log leaked handles after all tests complete. This runs after test-level afterAll hooks,
32
+ // so any handles still alive at this point were not properly cleaned up during teardown.
33
+ // This diagnostic helps identify the source of exit hangs without masking them.
34
+ afterAll(() => {
35
+ const handles = (process as any)._getActiveHandles();
36
+ if (handles.length > 0) {
37
+ const details = handles.map((h: any) => {
38
+ const type = h?.constructor?.name ?? typeof h;
39
+ const fd = h?.fd ?? h?._handle?.fd ?? '?';
40
+ const destroyed = h?.destroyed ?? '?';
41
+ const hasRef = typeof h?.hasRef === 'function' ? h.hasRef() : '?';
42
+ const localAddr = h?.localAddress ?? '';
43
+ const remoteAddr = h?.remoteAddress ?? '';
44
+ const localPort = h?.localPort ?? '';
45
+ const remotePort = h?.remotePort ?? '';
46
+ const proto = Object.getPrototypeOf(h)?.constructor?.name ?? '?';
47
+ const keys = Object.keys(h).slice(0, 10).join(',');
48
+ let fdTarget = '';
49
+ if (typeof fd === 'number') {
50
+ try {
51
+ fdTarget = ` -> ${readlinkSync(`/proc/self/fd/${fd}`)}`;
52
+ } catch {
53
+ // ignore
54
+ }
55
+ }
56
+ return ` ${type}(fd=${fd}, destroyed=${destroyed}, hasRef=${hasRef}${fdTarget}) proto=${proto} addr=${localAddr}:${localPort}->${remoteAddr}:${remotePort} keys=[${keys}]`;
57
+ });
58
+ process.stderr.write(
59
+ `\n[jest_setup] WARNING: ${handles.length} handle(s) still active after teardown:\n${details.join('\n')}\n` +
60
+ `These may prevent Jest from exiting. Investigate and fix the leak.\n\n`,
61
+ );
62
+ }
13
63
  });
@@ -19,7 +19,7 @@ export const submitTxsTo = async (
19
19
  times(numTxs, async () => {
20
20
  const accountManager = await wallet.createSchnorrAccount(Fr.random(), Fr.random(), GrumpkinScalar.random());
21
21
  const deployMethod = await accountManager.getDeployMethod();
22
- const txHash = await deployMethod.send({ from: submitter, wait: NO_WAIT });
22
+ const { txHash } = await deployMethod.send({ from: submitter, wait: NO_WAIT });
23
23
 
24
24
  logger.info(`Tx sent with hash ${txHash}`);
25
25
  const receipt: TxReceipt = await wallet.getTxReceipt(txHash);