@aztec/end-to-end 3.0.0-nightly.20251212 → 3.0.0-nightly.20251213

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 (46) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +3 -3
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +1 -1
  4. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +4 -4
  5. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  6. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +1 -1
  7. package/dest/e2e_epochs/epochs_test.d.ts +1 -1
  8. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  9. package/dest/e2e_epochs/epochs_test.js +0 -2
  10. package/dest/e2e_fees/fees_test.d.ts +3 -3
  11. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  12. package/dest/e2e_p2p/inactivity_slash_test.d.ts +1 -1
  13. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  14. package/dest/e2e_p2p/inactivity_slash_test.js +3 -6
  15. package/dest/e2e_p2p/p2p_network.d.ts +4 -5
  16. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  17. package/dest/e2e_p2p/p2p_network.js +5 -7
  18. package/dest/fixtures/e2e_prover_test.d.ts +3 -3
  19. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  20. package/dest/fixtures/e2e_prover_test.js +0 -1
  21. package/dest/fixtures/snapshot_manager.d.ts +6 -6
  22. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  23. package/dest/fixtures/snapshot_manager.js +16 -8
  24. package/dest/fixtures/utils.d.ts +9 -459
  25. package/dest/fixtures/utils.d.ts.map +1 -1
  26. package/dest/fixtures/utils.js +19 -51
  27. package/dest/shared/cross_chain_test_harness.js +1 -1
  28. package/dest/shared/uniswap_l1_l2.d.ts +3 -3
  29. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  30. package/dest/shared/uniswap_l1_l2.js +1 -1
  31. package/package.json +38 -38
  32. package/src/bench/client_flows/client_flows_benchmark.ts +3 -2
  33. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +11 -7
  34. package/src/e2e_epochs/epochs_test.ts +0 -2
  35. package/src/e2e_fees/fees_test.ts +2 -2
  36. package/src/e2e_p2p/inactivity_slash_test.ts +3 -8
  37. package/src/e2e_p2p/p2p_network.ts +3 -9
  38. package/src/fixtures/e2e_prover_test.ts +3 -3
  39. package/src/fixtures/snapshot_manager.ts +32 -14
  40. package/src/fixtures/utils.ts +47 -100
  41. package/src/shared/cross_chain_test_harness.ts +1 -1
  42. package/src/shared/uniswap_l1_l2.ts +4 -3
  43. package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
  44. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  45. package/dest/fixtures/setup_l1_contracts.js +0 -17
  46. package/src/fixtures/setup_l1_contracts.ts +0 -27
@@ -5,25 +5,24 @@ import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec
5
5
  import { AztecAddress } from '@aztec/aztec.js/addresses';
6
6
  import { BatchCall, type ContractMethod } from '@aztec/aztec.js/contracts';
7
7
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
8
+ import { Fr } from '@aztec/aztec.js/fields';
8
9
  import { type Logger, createLogger } from '@aztec/aztec.js/log';
9
10
  import { type AztecNode, createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
10
11
  import type { Wallet } from '@aztec/aztec.js/wallet';
11
12
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
12
13
  import { createBlobSinkClient } from '@aztec/blob-sink/client';
13
14
  import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
14
- import { GENESIS_ARCHIVE_ROOT, SPONSORED_FPC_SALT } from '@aztec/constants';
15
+ import { SPONSORED_FPC_SALT } from '@aztec/constants';
15
16
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
16
17
  import { createExtendedL1Client } from '@aztec/ethereum/client';
17
18
  import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
18
19
  import { NULL_KEY } from '@aztec/ethereum/constants';
19
- import { RollupContract, deployMulticall3 } from '@aztec/ethereum/contracts';
20
20
  import {
21
- type DeployL1ContractsArgs,
22
- type DeployL1ContractsReturnType,
21
+ type DeployAztecL1ContractsReturnType,
23
22
  type Operator,
24
- deployL1Contracts,
25
- } from '@aztec/ethereum/deploy-l1-contracts';
26
- import { FeeAssetArtifact } from '@aztec/ethereum/l1-artifacts';
23
+ type ZKPassportArgs,
24
+ deployAztecL1Contracts,
25
+ } from '@aztec/ethereum/deploy-aztec-l1-contracts';
27
26
  import {
28
27
  DelayedTxUtils,
29
28
  EthCheatCodes,
@@ -33,8 +32,6 @@ import {
33
32
  } from '@aztec/ethereum/test';
34
33
  import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
35
34
  import { SecretValue } from '@aztec/foundation/config';
36
- import { randomBytes } from '@aztec/foundation/crypto/random';
37
- import { Fr } from '@aztec/foundation/curves/bn254';
38
35
  import { EthAddress } from '@aztec/foundation/eth-address';
39
36
  import { tryRmDir } from '@aztec/foundation/fs';
40
37
  import { withLogNameSuffix } from '@aztec/foundation/log';
@@ -71,13 +68,20 @@ import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/serv
71
68
  import { getGenesisValues } from '@aztec/world-state/testing';
72
69
 
73
70
  import type { Anvil } from '@viem/anvil';
71
+ import { randomBytes } from 'crypto';
74
72
  import fs from 'fs/promises';
75
73
  import getPort from 'get-port';
76
74
  import { tmpdir } from 'os';
77
75
  import * as path from 'path';
78
- import { type Chain, type HDAccount, type Hex, type PrivateKeyAccount, getContract } from 'viem';
79
- import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
80
- import { foundry } from 'viem/chains';
76
+ import type { Hex } from 'viem';
77
+ import {
78
+ type HDAccount,
79
+ type PrivateKeyAccount,
80
+ generatePrivateKey,
81
+ mnemonicToAccount,
82
+ privateKeyToAccount,
83
+ } from 'viem/accounts';
84
+ import { type Chain, foundry } from 'viem/chains';
81
85
 
82
86
  import { MNEMONIC, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
83
87
  import { getACVMConfig } from './get_acvm_config.js';
@@ -110,37 +114,6 @@ export const getPrivateKeyFromIndex = (index: number): Buffer | null => {
110
114
  return privKeyRaw === null ? null : Buffer.from(privKeyRaw);
111
115
  };
112
116
 
113
- export const setupL1Contracts = async (
114
- l1RpcUrls: string[],
115
- account: HDAccount | PrivateKeyAccount,
116
- logger: Logger,
117
- args: Partial<DeployL1ContractsArgs> = {},
118
- chain: Chain = foundry,
119
- ) => {
120
- const l1Data = await deployL1Contracts(
121
- l1RpcUrls,
122
- account,
123
- chain,
124
- logger,
125
- {
126
- vkTreeRoot: getVKTreeRoot(),
127
- protocolContractsHash,
128
- genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
129
- salt: args.salt,
130
- initialValidators: args.initialValidators,
131
- ...getL1ContractsConfigEnvVars(),
132
- realVerifier: false,
133
- ...args,
134
- },
135
- {
136
- priorityFeeBumpPercentage: 0,
137
- priorityFeeRetryBumpPercentage: 0,
138
- },
139
- );
140
-
141
- return l1Data;
142
- };
143
-
144
117
  /**
145
118
  * Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
146
119
  * @param aztecNode - An instance of Aztec Node.
@@ -217,7 +190,7 @@ async function setupWithRemoteEnvironment(
217
190
 
218
191
  const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
219
192
 
220
- const deployL1ContractsValues: DeployL1ContractsReturnType = {
193
+ const deployL1ContractsValues: DeployAztecL1ContractsReturnType = {
221
194
  l1ContractAddresses,
222
195
  l1Client,
223
196
  rollupVersion,
@@ -272,17 +245,13 @@ export type SetupOptions = {
272
245
  /** Whether to enable metrics collection, if undefined, metrics collection is disabled */
273
246
  metricsPort?: number | undefined;
274
247
  /** Previously deployed contracts on L1 */
275
- deployL1ContractsValues?: DeployL1ContractsReturnType;
276
- /** Whether to skip deployment of protocol contracts (auth registry, etc) */
277
- skipProtocolContracts?: boolean;
248
+ deployL1ContractsValues?: DeployAztecL1ContractsReturnType;
278
249
  /** Initial fee juice for default accounts */
279
250
  initialAccountFeeJuice?: Fr;
280
251
  /** Number of initial accounts funded with fee juice */
281
252
  numberOfInitialFundedAccounts?: number;
282
253
  /** Data of the initial funded accounts */
283
254
  initialFundedAccounts?: InitialAccountData[];
284
- /** Salt to use in L1 contract deployment */
285
- salt?: number;
286
255
  /** An initial set of validators */
287
256
  initialValidators?: (Operator & { privateKey: `0x${string}` })[];
288
257
  /** Anvil Start time */
@@ -291,8 +260,6 @@ export type SetupOptions = {
291
260
  l2StartTime?: number;
292
261
  /** Whether to start a prover node */
293
262
  startProverNode?: boolean;
294
- /** Whether to fund the rewardDistributor */
295
- fundRewardDistributor?: boolean;
296
263
  /** Manual config for the telemetry client */
297
264
  telemetryConfig?: Partial<TelemetryClientConfig> & { benchmark?: boolean };
298
265
  /** Public data that will be inserted in the tree in genesis */
@@ -311,6 +278,8 @@ export type SetupOptions = {
311
278
  anvilPort?: number;
312
279
  /** Key to use for publishing L1 contracts */
313
280
  l1PublisherKey?: SecretValue<`0x${string}`>;
281
+ /** ZkPassport configuration (domain, scope, mock verifier) */
282
+ zkPassportArgs?: ZKPassportArgs;
314
283
  } & Partial<AztecNodeConfig>;
315
284
 
316
285
  /** Context for an end-to-end test as returned by the `setup` function */
@@ -323,8 +292,8 @@ export type EndToEndContext = {
323
292
  proverNode: ProverNode | undefined;
324
293
  /** A client to the sequencer service (undefined if connected to remote environment) */
325
294
  sequencer: SequencerClient | undefined;
326
- /** Return values from deployL1Contracts function. */
327
- deployL1ContractsValues: DeployL1ContractsReturnType;
295
+ /** Return values from deployAztecL1Contracts function. */
296
+ deployL1ContractsValues: DeployAztecL1ContractsReturnType;
328
297
  /** The Aztec Node configuration. */
329
298
  config: AztecNodeConfig;
330
299
  /** The data for the initial funded accounts. */
@@ -428,24 +397,27 @@ export async function setup(
428
397
  await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
429
398
  }
430
399
 
431
- let publisherPrivKey = undefined;
432
- let publisherHdAccount = undefined;
400
+ let publisherPrivKeyHex: `0x${string}` | undefined = undefined;
401
+ let publisherHdAccount: HDAccount | PrivateKeyAccount | undefined = undefined;
433
402
 
434
403
  if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
435
- publisherHdAccount = privateKeyToAccount(opts.l1PublisherKey.getValue());
404
+ publisherPrivKeyHex = opts.l1PublisherKey.getValue();
405
+ publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
436
406
  } else if (
437
407
  config.publisherPrivateKeys &&
438
408
  config.publisherPrivateKeys.length > 0 &&
439
409
  config.publisherPrivateKeys[0].getValue() != NULL_KEY
440
410
  ) {
441
- publisherHdAccount = privateKeyToAccount(config.publisherPrivateKeys[0].getValue());
411
+ publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
412
+ publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
442
413
  } else if (!MNEMONIC) {
443
414
  throw new Error(`Mnemonic not provided and no publisher private key`);
444
415
  } else {
445
416
  publisherHdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: 0 });
446
417
  const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
447
- publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
448
- config.publisherPrivateKeys = [new SecretValue(`0x${publisherPrivKey!.toString('hex')}` as const)];
418
+ const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
419
+ publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
420
+ config.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
449
421
  }
450
422
 
451
423
  if (config.coinbase === undefined) {
@@ -473,51 +445,26 @@ export async function setup(
473
445
  }
474
446
 
475
447
  const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount!, chain);
476
- await deployMulticall3(l1Client, logger);
477
-
478
- const deployL1ContractsValues =
479
- opts.deployL1ContractsValues ??
480
- (await setupL1Contracts(
481
- config.l1RpcUrls,
482
- publisherHdAccount!,
483
- logger,
484
- {
485
- ...opts,
486
- genesisArchiveRoot,
487
- feeJuicePortalInitialBalance: fundingNeeded,
488
- initialValidators: opts.initialValidators,
489
- },
490
- chain,
491
- ));
448
+
449
+ const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await deployAztecL1Contracts(
450
+ config.l1RpcUrls[0],
451
+ publisherPrivKeyHex!,
452
+ chain.id,
453
+ {
454
+ ...getL1ContractsConfigEnvVars(),
455
+ ...opts,
456
+ vkTreeRoot: getVKTreeRoot(),
457
+ protocolContractsHash,
458
+ genesisArchiveRoot,
459
+ initialValidators: opts.initialValidators,
460
+ feeJuicePortalInitialBalance: fundingNeeded,
461
+ realVerifier: false,
462
+ },
463
+ );
492
464
 
493
465
  config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
494
466
  config.rollupVersion = deployL1ContractsValues.rollupVersion;
495
467
 
496
- if (opts.fundRewardDistributor) {
497
- // Mints block rewards for 10000 blocks to the rewardDistributor contract
498
-
499
- const rollup = new RollupContract(
500
- deployL1ContractsValues.l1Client,
501
- deployL1ContractsValues.l1ContractAddresses.rollupAddress,
502
- );
503
-
504
- const blockReward = await rollup.getCheckpointReward();
505
- const mintAmount = 10_000n * (blockReward as bigint);
506
-
507
- const feeJuice = getContract({
508
- address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
509
- abi: FeeAssetArtifact.contractAbi,
510
- client: deployL1ContractsValues.l1Client,
511
- });
512
-
513
- const rewardDistributorMintTxHash = await feeJuice.write.mint(
514
- [deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(), mintAmount],
515
- {} as any,
516
- );
517
- await deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: rewardDistributorMintTxHash });
518
- logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
519
- }
520
-
521
468
  if (enableAutomine) {
522
469
  await ethCheatCodes.setAutomine(false);
523
470
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
@@ -13,7 +13,7 @@ import type { AztecNode } from '@aztec/aztec.js/node';
13
13
  import type { SiblingPath } from '@aztec/aztec.js/trees';
14
14
  import type { TxReceipt } from '@aztec/aztec.js/tx';
15
15
  import type { Wallet } from '@aztec/aztec.js/wallet';
16
- import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contracts';
16
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
17
17
  import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
18
18
  import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
19
19
  import { BlockNumber } from '@aztec/foundation/branded-types';
@@ -6,7 +6,8 @@ import type { Logger } from '@aztec/aztec.js/log';
6
6
  import type { AztecNode } from '@aztec/aztec.js/node';
7
7
  import { CheatCodes } from '@aztec/aztec/testing';
8
8
  import { RollupContract } from '@aztec/ethereum/contracts';
9
- import { type DeployL1ContractsReturnType, deployL1Contract } from '@aztec/ethereum/deploy-l1-contracts';
9
+ import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
10
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
10
11
  import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
11
12
  import { extractEvent } from '@aztec/ethereum/utils';
12
13
  import { sha256ToField } from '@aztec/foundation/crypto/sha256';
@@ -46,7 +47,7 @@ export type UniswapSetupContext = {
46
47
  /** The sponsor wallet. */
47
48
  sponsorAddress: AztecAddress;
48
49
  /** */
49
- deployL1ContractsValues: DeployL1ContractsReturnType;
50
+ deployL1ContractsValues: DeployAztecL1ContractsReturnType;
50
51
  /** Cheat codes instance. */
51
52
  cheatCodes: CheatCodes;
52
53
  };
@@ -76,7 +77,7 @@ export const uniswapL1L2TestSuite = (
76
77
  let daiCrossChainHarness: CrossChainTestHarness;
77
78
  let wethCrossChainHarness: CrossChainTestHarness;
78
79
 
79
- let deployL1ContractsValues: DeployL1ContractsReturnType;
80
+ let deployL1ContractsValues: DeployAztecL1ContractsReturnType;
80
81
  let rollup: RollupContract;
81
82
  let uniswapPortal: GetContractReturnType<typeof UniswapPortalAbi, ExtendedViemWalletClient>;
82
83
  let uniswapPortalAddress: EthAddress;