@aztec/end-to-end 3.0.0-nightly.20251211 → 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 (60) 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 +6 -8
  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/setup_p2p_test.js +3 -3
  22. package/dest/fixtures/snapshot_manager.d.ts +6 -6
  23. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  24. package/dest/fixtures/snapshot_manager.js +18 -10
  25. package/dest/fixtures/utils.d.ts +9 -459
  26. package/dest/fixtures/utils.d.ts.map +1 -1
  27. package/dest/fixtures/utils.js +22 -54
  28. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  29. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  30. package/dest/fixtures/with_telemetry_utils.js +2 -2
  31. package/dest/shared/cross_chain_test_harness.js +1 -1
  32. package/dest/shared/uniswap_l1_l2.d.ts +3 -3
  33. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  34. package/dest/shared/uniswap_l1_l2.js +1 -1
  35. package/dest/spartan/tx_metrics.d.ts +39 -0
  36. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  37. package/dest/spartan/tx_metrics.js +95 -0
  38. package/dest/spartan/utils.d.ts +2 -2
  39. package/dest/spartan/utils.d.ts.map +1 -1
  40. package/dest/spartan/utils.js +2 -2
  41. package/package.json +38 -38
  42. package/src/bench/client_flows/client_flows_benchmark.ts +3 -2
  43. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +11 -7
  44. package/src/e2e_epochs/epochs_test.ts +0 -2
  45. package/src/e2e_fees/fees_test.ts +2 -2
  46. package/src/e2e_p2p/inactivity_slash_test.ts +3 -6
  47. package/src/e2e_p2p/p2p_network.ts +4 -10
  48. package/src/fixtures/e2e_prover_test.ts +3 -3
  49. package/src/fixtures/setup_p2p_test.ts +3 -3
  50. package/src/fixtures/snapshot_manager.ts +34 -16
  51. package/src/fixtures/utils.ts +50 -103
  52. package/src/fixtures/with_telemetry_utils.ts +2 -2
  53. package/src/shared/cross_chain_test_harness.ts +1 -1
  54. package/src/shared/uniswap_l1_l2.ts +4 -3
  55. package/src/spartan/tx_metrics.ts +130 -0
  56. package/src/spartan/utils.ts +2 -2
  57. package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
  58. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  59. package/dest/fixtures/setup_l1_contracts.js +0 -17
  60. package/src/fixtures/setup_l1_contracts.ts +0 -27
@@ -7,7 +7,8 @@ import type { Wallet } from '@aztec/aztec.js/wallet';
7
7
  import { CheatCodes } from '@aztec/aztec/testing';
8
8
  import { createExtendedL1Client } from '@aztec/ethereum/client';
9
9
  import { RollupContract } from '@aztec/ethereum/contracts';
10
- import { type DeployL1ContractsArgs, deployL1Contract } from '@aztec/ethereum/deploy-l1-contracts';
10
+ import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
11
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
11
12
  import { ChainMonitor } from '@aztec/ethereum/test';
12
13
  import { randomBytes } from '@aztec/foundation/crypto/random';
13
14
  import { Fr } from '@aztec/foundation/curves/bn254';
@@ -125,7 +126,7 @@ export class ClientFlowsBenchmark {
125
126
 
126
127
  private proxyLogger: ProxyLogger;
127
128
 
128
- constructor(testName?: string, setupOptions: Partial<SetupOptions & DeployL1ContractsArgs> = {}) {
129
+ constructor(testName?: string, setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {}) {
129
130
  this.logger = createLogger(`bench:client_flows${testName ? `:${testName}` : ''}`);
130
131
  this.snapshotManager = createSnapshotManager(
131
132
  `bench_client_flows${testName ? `/${testName}` : ''}`,
@@ -4,11 +4,11 @@ import { type Logger, createLogger } from '@aztec/aztec.js/log';
4
4
  import type { AztecNode } from '@aztec/aztec.js/node';
5
5
  import { CheatCodes } from '@aztec/aztec/testing';
6
6
  import { createExtendedL1Client } from '@aztec/ethereum/client';
7
- import {
8
- type DeployL1ContractsArgs,
9
- type DeployL1ContractsReturnType,
10
- deployL1Contract,
11
- } from '@aztec/ethereum/deploy-l1-contracts';
7
+ import type {
8
+ DeployAztecL1ContractsArgs,
9
+ DeployAztecL1ContractsReturnType,
10
+ } from '@aztec/ethereum/deploy-aztec-l1-contracts';
11
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
12
12
  import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
13
13
  import { InboxAbi, OutboxAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts';
14
14
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
@@ -54,9 +54,13 @@ export class CrossChainMessagingTest {
54
54
  outbox!: any; // GetContractReturnType<typeof OutboxAbi> | undefined;
55
55
  cheatCodes!: CheatCodes;
56
56
 
57
- deployL1ContractsValues!: DeployL1ContractsReturnType;
57
+ deployL1ContractsValues!: DeployAztecL1ContractsReturnType;
58
58
 
59
- constructor(testName: string, opts: SetupOptions = {}, deployL1ContractsArgs: Partial<DeployL1ContractsArgs> = {}) {
59
+ constructor(
60
+ testName: string,
61
+ opts: SetupOptions = {},
62
+ deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {},
63
+ ) {
60
64
  this.logger = createLogger(`e2e:e2e_cross_chain_messaging:${testName}`);
61
65
  this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath, opts, {
62
66
  initialValidators: [],
@@ -114,8 +114,6 @@ export class EpochsTestContext {
114
114
  checkIntervalMs: 50,
115
115
  archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
116
116
  worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
117
- skipProtocolContracts: true,
118
- salt: 1,
119
117
  aztecEpochDuration,
120
118
  aztecSlotDuration,
121
119
  ethereumSlotDuration,
@@ -4,7 +4,7 @@ import type { AztecNode } from '@aztec/aztec.js/node';
4
4
  import { CheatCodes } from '@aztec/aztec/testing';
5
5
  import { createExtendedL1Client } from '@aztec/ethereum/client';
6
6
  import { RollupContract } from '@aztec/ethereum/contracts';
7
- import type { DeployL1ContractsArgs } from '@aztec/ethereum/deploy-l1-contracts';
7
+ import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
8
8
  import { ChainMonitor } from '@aztec/ethereum/test';
9
9
  import { BlockNumber } from '@aztec/foundation/branded-types';
10
10
  import { EthAddress } from '@aztec/foundation/eth-address';
@@ -97,7 +97,7 @@ export class FeesTest {
97
97
  constructor(
98
98
  testName: string,
99
99
  private numberOfAccounts = 3,
100
- setupOptions: Partial<SetupOptions & DeployL1ContractsArgs> = {},
100
+ setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {},
101
101
  ) {
102
102
  if (!numberOfAccounts) {
103
103
  throw new Error('There must be at least 1 initial account.');
@@ -24,7 +24,7 @@ const SLASHING_UNIT = BigInt(1e18);
24
24
  const SLASHING_AMOUNT = SLASHING_UNIT * 3n;
25
25
 
26
26
  // How many epochs it may take to set everything up, so we dont slash during this period
27
- const SETUP_EPOCH_DURATION = 5;
27
+ const SETUP_EPOCH_DURATION = 8;
28
28
 
29
29
  export class P2PInactivityTest {
30
30
  public nodes!: AztecNodeService[];
@@ -151,11 +151,8 @@ export class P2PInactivityTest {
151
151
  // This prevents race conditions where validators propose blocks before the network is ready
152
152
  await this.test.waitForP2PMeshConnectivity(this.nodes, NUM_NODES);
153
153
 
154
- const ethereumSlotDuration = this.test.ctx.aztecNodeConfig.ethereumSlotDuration!;
155
- this.test.logger.warn(`Advancing to the L1 slot before epoch ${SETUP_EPOCH_DURATION + 1} to start slashing`);
156
- await this.test.ctx.cheatCodes.rollup.advanceToEpoch(EpochNumber(SETUP_EPOCH_DURATION + 1), {
157
- offset: -ethereumSlotDuration,
158
- });
154
+ this.test.logger.warn(`Advancing to epoch ${SETUP_EPOCH_DURATION - 1} (slashing will start after it is completed)`);
155
+ await this.test.ctx.cheatCodes.rollup.advanceToEpoch(EpochNumber(SETUP_EPOCH_DURATION - 1));
159
156
 
160
157
  return this;
161
158
  }
@@ -9,8 +9,8 @@ import {
9
9
  RollupContract,
10
10
  type TallySlashingProposerContract,
11
11
  } from '@aztec/ethereum/contracts';
12
- import type { Operator } from '@aztec/ethereum/deploy-l1-contracts';
13
- import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contracts';
12
+ import type { Operator } from '@aztec/ethereum/deploy-aztec-l1-contracts';
13
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
14
14
  import { MultiAdderArtifact } from '@aztec/ethereum/l1-artifacts';
15
15
  import { createL1TxUtilsFromViemWallet } from '@aztec/ethereum/l1-tx-utils';
16
16
  import { ChainMonitor } from '@aztec/ethereum/test';
@@ -93,7 +93,6 @@ export class P2PNetworkTest {
93
93
  // If set enable metrics collection
94
94
  private metricsPort?: number,
95
95
  startProverNode?: boolean,
96
- mockZkPassportVerifier?: boolean,
97
96
  ) {
98
97
  this.logger = createLogger(`e2e:e2e_p2p:${testName}`);
99
98
 
@@ -122,7 +121,6 @@ export class P2PNetworkTest {
122
121
  initialValidatorConfig.slashingRoundSizeInEpochs ?? l1ContractsConfig.slashingRoundSizeInEpochs,
123
122
  slasherFlavor: initialValidatorConfig.slasherFlavor ?? 'tally',
124
123
  aztecTargetCommitteeSize: numberOfValidators,
125
- salt: 420,
126
124
  metricsPort: metricsPort,
127
125
  numberOfInitialFundedAccounts: 2,
128
126
  startProverNode,
@@ -141,7 +139,6 @@ export class P2PNetworkTest {
141
139
  aztecTargetCommitteeSize: numberOfValidators,
142
140
  initialValidators: [],
143
141
  zkPassportArgs: {
144
- mockZkPassportVerifier,
145
142
  zkPassportDomain: zkPassportParams.domain,
146
143
  zkPassportScope: zkPassportParams.scope,
147
144
  },
@@ -157,7 +154,6 @@ export class P2PNetworkTest {
157
154
  metricsPort,
158
155
  initialConfig,
159
156
  startProverNode,
160
- mockZkPassportVerifier,
161
157
  }: {
162
158
  testName: string;
163
159
  numberOfNodes: number;
@@ -166,7 +162,6 @@ export class P2PNetworkTest {
166
162
  metricsPort?: number;
167
163
  initialConfig?: SetupOptions;
168
164
  startProverNode?: boolean;
169
- mockZkPassportVerifier?: boolean;
170
165
  }) {
171
166
  const port = basePort || (await getPort());
172
167
 
@@ -187,7 +182,6 @@ export class P2PNetworkTest {
187
182
  numberOfNodes,
188
183
  metricsPort,
189
184
  startProverNode,
190
- mockZkPassportVerifier,
191
185
  );
192
186
  }
193
187
 
@@ -200,7 +194,7 @@ export class P2PNetworkTest {
200
194
 
201
195
  async addBootstrapNode() {
202
196
  await this.snapshotManager.snapshot('add-bootstrap-node', async ({ aztecNodeConfig }) => {
203
- const telemetry = getEndToEndTestTelemetryClient(this.metricsPort);
197
+ const telemetry = await getEndToEndTestTelemetryClient(this.metricsPort);
204
198
  this.bootstrapNode = await createBootstrapNodeFromPrivateKey(
205
199
  BOOTSTRAP_NODE_PRIVATE_KEY,
206
200
  this.bootNodePort,
@@ -448,7 +442,7 @@ export class P2PNetworkTest {
448
442
  slashFactory: SlashFactoryContract;
449
443
  }> {
450
444
  if (!this.ctx.deployL1ContractsValues) {
451
- throw new Error('DeployL1ContractsValues not set');
445
+ throw new Error('DeployAztecL1ContractsValues not set');
452
446
  }
453
447
 
454
448
  const rollup = new RollupContract(
@@ -13,7 +13,7 @@ import {
13
13
  import { BackendType, Barretenberg } from '@aztec/bb.js';
14
14
  import { createBlobSinkClient } from '@aztec/blob-sink/client';
15
15
  import type { BlobSinkServer } from '@aztec/blob-sink/server';
16
- import type { DeployL1ContractsReturnType } from '@aztec/ethereum/deploy-l1-contracts';
16
+ import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
17
17
  import { Buffer32 } from '@aztec/foundation/buffer';
18
18
  import { SecretValue } from '@aztec/foundation/config';
19
19
  import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
@@ -78,7 +78,7 @@ export class FullProverTest {
78
78
  private context!: SubsystemsContext;
79
79
  private proverNode!: ProverNode;
80
80
  private simulatedProverNode!: ProverNode;
81
- public l1Contracts!: DeployL1ContractsReturnType;
81
+ public l1Contracts!: DeployAztecL1ContractsReturnType;
82
82
  public proverAddress!: EthAddress;
83
83
 
84
84
  constructor(
@@ -91,7 +91,7 @@ export class FullProverTest {
91
91
  this.snapshotManager = createSnapshotManager(
92
92
  `full_prover_integration/${testName}`,
93
93
  dataPath,
94
- { startProverNode: true, fundRewardDistributor: true, coinbase },
94
+ { startProverNode: true, coinbase },
95
95
  {
96
96
  realVerifier: realProofs,
97
97
  },
@@ -99,7 +99,7 @@ export async function createNode(
99
99
  ) {
100
100
  const createNode = async () => {
101
101
  const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
102
- const telemetry = getEndToEndTestTelemetryClient(metricsPort);
102
+ const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
103
103
  return await AztecNodeService.createAndSync(
104
104
  validatorConfig,
105
105
  { telemetry, dateProvider },
@@ -128,7 +128,7 @@ export async function createNonValidatorNode(
128
128
  validatorPrivateKeys: undefined,
129
129
  publisherPrivateKeys: [],
130
130
  };
131
- const telemetry = getEndToEndTestTelemetryClient(metricsPort);
131
+ const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
132
132
  return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, { prefilledPublicData });
133
133
  };
134
134
  return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
@@ -147,7 +147,7 @@ export async function createProverNode(
147
147
  ) {
148
148
  const createProverNode = async () => {
149
149
  const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!;
150
- const telemetry = getEndToEndTestTelemetryClient(metricsPort);
150
+ const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
151
151
 
152
152
  const proverConfig: Partial<ProverNodeConfig> = await createP2PConfig(
153
153
  config,
@@ -13,7 +13,11 @@ import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/serv
13
13
  import { createExtendedL1Client } from '@aztec/ethereum/client';
14
14
  import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
15
15
  import { deployMulticall3 } from '@aztec/ethereum/contracts';
16
- import type { DeployL1ContractsArgs, DeployL1ContractsReturnType } from '@aztec/ethereum/deploy-l1-contracts';
16
+ import {
17
+ type DeployAztecL1ContractsArgs,
18
+ type DeployAztecL1ContractsReturnType,
19
+ deployAztecL1Contracts,
20
+ } from '@aztec/ethereum/deploy-aztec-l1-contracts';
17
21
  import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
18
22
  import { asyncMap } from '@aztec/foundation/async-map';
19
23
  import { SecretValue } from '@aztec/foundation/config';
@@ -22,6 +26,8 @@ import { tryRmDir } from '@aztec/foundation/fs';
22
26
  import { createLogger } from '@aztec/foundation/log';
23
27
  import { resolver, reviver } from '@aztec/foundation/serialize';
24
28
  import { TestDateProvider } from '@aztec/foundation/timer';
29
+ import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
30
+ import { protocolContractsHash } from '@aztec/protocol-contracts';
25
31
  import type { ProverNode } from '@aztec/prover-node';
26
32
  import { getPXEConfig } from '@aztec/pxe/server';
27
33
  import type { SequencerClient } from '@aztec/sequencer-client';
@@ -44,7 +50,6 @@ import { foundry } from 'viem/chains';
44
50
  import { MNEMONIC, TEST_MAX_TX_POOL_SIZE, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
45
51
  import { getACVMConfig } from './get_acvm_config.js';
46
52
  import { getBBConfig } from './get_bb_config.js';
47
- import { setupL1Contracts } from './setup_l1_contracts.js';
48
53
  import {
49
54
  type SetupOptions,
50
55
  createAndSyncProverNode,
@@ -61,7 +66,7 @@ export type SubsystemsContext = {
61
66
  aztecNode: AztecNodeService;
62
67
  aztecNodeConfig: AztecNodeConfig;
63
68
  wallet: TestWallet;
64
- deployL1ContractsValues: DeployL1ContractsReturnType;
69
+ deployL1ContractsValues: DeployAztecL1ContractsReturnType;
65
70
  proverNode?: ProverNode;
66
71
  watcher: AnvilTestWatcher;
67
72
  cheatCodes: CheatCodes;
@@ -83,7 +88,7 @@ export function createSnapshotManager(
83
88
  testName: string,
84
89
  dataPath?: string,
85
90
  config: Partial<SetupOptions> = {},
86
- deployL1ContractsArgs: Partial<DeployL1ContractsArgs> = {
91
+ deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {
87
92
  initialValidators: [],
88
93
  },
89
94
  ) {
@@ -112,7 +117,7 @@ class MockSnapshotManager implements ISnapshotManager {
112
117
  constructor(
113
118
  testName: string,
114
119
  private config: Partial<AztecNodeConfig> = {},
115
- private deployL1ContractsArgs: Partial<DeployL1ContractsArgs> = {},
120
+ private deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {},
116
121
  ) {
117
122
  this.logger = createLogger(`e2e:snapshot_manager:${testName}`);
118
123
  this.logger.warn(`No data path given, will not persist any snapshots.`);
@@ -160,7 +165,7 @@ class SnapshotManager implements ISnapshotManager {
160
165
  testName: string,
161
166
  private dataPath: string,
162
167
  private config: Partial<SetupOptions> = {},
163
- private deployL1ContractsArgs: Partial<DeployL1ContractsArgs> = {},
168
+ private deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {},
164
169
  ) {
165
170
  this.livePath = join(this.dataPath, 'live', testName);
166
171
  this.logger = createLogger(`e2e:snapshot_manager:${testName}`);
@@ -286,7 +291,7 @@ async function setupFromFresh(
286
291
  statePath: string | undefined,
287
292
  logger: Logger,
288
293
  { numberOfInitialFundedAccounts = 10, ...opts }: SetupOptions = {},
289
- deployL1ContractsArgs: Partial<DeployL1ContractsArgs> = {
294
+ deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {
290
295
  initialValidators: [],
291
296
  },
292
297
  ): Promise<SubsystemsContext> {
@@ -326,13 +331,14 @@ async function setupFromFresh(
326
331
  const hdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: 0 });
327
332
  const publisherPrivKeyRaw = hdAccount.getHdKey().privateKey;
328
333
  const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
334
+ const publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` satisfies `0x${string}`;
329
335
 
330
336
  const l1Client = createExtendedL1Client([aztecNodeConfig.l1RpcUrls[0]], hdAccount, foundry);
331
337
 
332
338
  const validatorPrivKey = getPrivateKeyFromIndex(0);
333
339
  const proverNodePrivateKey = getPrivateKeyFromIndex(0);
334
340
 
335
- aztecNodeConfig.publisherPrivateKeys = [new SecretValue<`0x${string}`>(`0x${publisherPrivKey!.toString('hex')}`)];
341
+ aztecNodeConfig.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
336
342
  aztecNodeConfig.validatorPrivateKeys = new SecretValue([`0x${validatorPrivKey!.toString('hex')}`]);
337
343
  aztecNodeConfig.coinbase = opts.coinbase ?? EthAddress.fromString(`${hdAccount.address}`);
338
344
 
@@ -348,7 +354,7 @@ async function setupFromFresh(
348
354
  const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider);
349
355
 
350
356
  // Deploy our L1 contracts.
351
- logger.verbose('Deploying L1 contracts...');
357
+ logger.verbose('Deploying Aztec L1 contracts...');
352
358
  if (opts.l1StartTime) {
353
359
  await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
354
360
  }
@@ -360,16 +366,28 @@ async function setupFromFresh(
360
366
  opts.initialAccountFeeJuice,
361
367
  );
362
368
 
369
+ const vkTreeRoot = getVKTreeRoot();
363
370
  await deployMulticall3(l1Client, logger);
364
371
 
365
- const deployL1ContractsValues = await setupL1Contracts(aztecNodeConfig.l1RpcUrls[0], hdAccount, logger, {
372
+ // Define args, defaulted to our environment variables.
373
+ const args: DeployAztecL1ContractsArgs = {
366
374
  ...getL1ContractsConfigEnvVars(),
367
- genesisArchiveRoot,
368
- feeJuicePortalInitialBalance: fundingNeeded,
369
- salt: opts.salt,
370
375
  ...deployL1ContractsArgs,
376
+ vkTreeRoot,
377
+ genesisArchiveRoot,
378
+ protocolContractsHash,
371
379
  initialValidators: opts.initialValidators,
372
- });
380
+ feeJuicePortalInitialBalance: fundingNeeded,
381
+ realVerifier: false,
382
+ };
383
+
384
+ const deployL1ContractsValues = await deployAztecL1Contracts(
385
+ aztecNodeConfig.l1RpcUrls[0],
386
+ publisherPrivKeyHex,
387
+ foundry.id,
388
+ args,
389
+ );
390
+
373
391
  aztecNodeConfig.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
374
392
  aztecNodeConfig.rollupVersion = deployL1ContractsValues.rollupVersion;
375
393
 
@@ -393,7 +411,7 @@ async function setupFromFresh(
393
411
  aztecNodeConfig.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
394
412
  }
395
413
 
396
- const telemetry = getEndToEndTestTelemetryClient(opts.metricsPort);
414
+ const telemetry = await getEndToEndTestTelemetryClient(opts.metricsPort);
397
415
 
398
416
  // Setup blob sink service
399
417
  const blobSink = await createBlobSinkServer(
@@ -523,7 +541,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
523
541
  );
524
542
  await watcher.start();
525
543
 
526
- const telemetry = initTelemetryClient(getTelemetryConfig());
544
+ const telemetry = await initTelemetryClient(getTelemetryConfig());
527
545
  const blobSink = await createBlobSinkServer(
528
546
  {
529
547
  l1ChainId: aztecNodeConfig.l1ChainId,
@@ -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';
@@ -91,10 +95,10 @@ const { AZTEC_NODE_URL = '' } = process.env;
91
95
  const getAztecUrl = () => AZTEC_NODE_URL;
92
96
 
93
97
  let telemetry: TelemetryClient | undefined = undefined;
94
- function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
98
+ async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
95
99
  if (!telemetry) {
96
100
  const config = { ...getTelemetryConfig(), ...partialConfig };
97
- telemetry = config.benchmark ? new BenchmarkTelemetryClient() : initTelemetryClient(config);
101
+ telemetry = config.benchmark ? new BenchmarkTelemetryClient() : await initTelemetryClient(config);
98
102
  }
99
103
  return telemetry;
100
104
  }
@@ -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);
@@ -540,7 +487,7 @@ export async function setup(
540
487
  await watcher.start();
541
488
  }
542
489
 
543
- const telemetry = getTelemetryClient(opts.telemetryConfig);
490
+ const telemetry = await getTelemetryClient(opts.telemetryConfig);
544
491
 
545
492
  // Blob sink service - blobs get posted here and served from here
546
493
  const blobSinkPort = await getPort();