@aztec/end-to-end 0.0.1-commit.b655e406 → 0.0.1-commit.c7c42ec

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 (150) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +1 -1
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.d.ts +10 -3
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  5. package/dest/bench/client_flows/client_flows_benchmark.js +58 -33
  6. package/dest/bench/client_flows/config.d.ts +1 -1
  7. package/dest/bench/client_flows/data_extractor.d.ts +1 -1
  8. package/dest/bench/client_flows/data_extractor.js +5 -27
  9. package/dest/bench/utils.d.ts +3 -3
  10. package/dest/bench/utils.d.ts.map +1 -1
  11. package/dest/bench/utils.js +10 -6
  12. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
  13. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  14. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +2 -2
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +5 -4
  16. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  17. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +6 -4
  18. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  19. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.d.ts +11 -9
  21. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  22. package/dest/e2e_epochs/epochs_test.js +17 -14
  23. package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
  24. package/dest/e2e_fees/bridging_race.notest.js +2 -2
  25. package/dest/e2e_fees/fees_test.d.ts +8 -4
  26. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  27. package/dest/e2e_fees/fees_test.js +16 -10
  28. package/dest/e2e_l1_publisher/write_json.d.ts +1 -1
  29. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  30. package/dest/e2e_l1_publisher/write_json.js +5 -4
  31. package/dest/e2e_multi_validator/utils.d.ts +1 -1
  32. package/dest/e2e_multi_validator/utils.js +1 -1
  33. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  34. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  35. package/dest/e2e_nested_contract/nested_contract_test.js +4 -3
  36. package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
  37. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  38. package/dest/e2e_p2p/inactivity_slash_test.js +4 -3
  39. package/dest/e2e_p2p/p2p_network.d.ts +219 -13
  40. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  41. package/dest/e2e_p2p/p2p_network.js +15 -11
  42. package/dest/e2e_p2p/shared.d.ts +6 -6
  43. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  44. package/dest/e2e_p2p/shared.js +6 -5
  45. package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
  46. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  47. package/dest/e2e_token_contract/token_contract_test.js +2 -2
  48. package/dest/fixtures/e2e_prover_test.d.ts +5 -5
  49. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  50. package/dest/fixtures/e2e_prover_test.js +23 -22
  51. package/dest/fixtures/fixtures.d.ts +2 -3
  52. package/dest/fixtures/fixtures.d.ts.map +1 -1
  53. package/dest/fixtures/fixtures.js +2 -3
  54. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  55. package/dest/fixtures/get_acvm_config.js +1 -1
  56. package/dest/fixtures/get_bb_config.d.ts +1 -1
  57. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  58. package/dest/fixtures/index.d.ts +1 -1
  59. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  60. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  61. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  62. package/dest/fixtures/logging.d.ts +1 -1
  63. package/dest/fixtures/setup_p2p_test.d.ts +4 -4
  64. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  65. package/dest/fixtures/setup_p2p_test.js +18 -10
  66. package/dest/fixtures/snapshot_manager.d.ts +6 -8
  67. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  68. package/dest/fixtures/snapshot_manager.js +34 -46
  69. package/dest/fixtures/token_utils.d.ts +5 -2
  70. package/dest/fixtures/token_utils.d.ts.map +1 -1
  71. package/dest/fixtures/token_utils.js +7 -4
  72. package/dest/fixtures/utils.d.ts +21 -19
  73. package/dest/fixtures/utils.d.ts.map +1 -1
  74. package/dest/fixtures/utils.js +56 -85
  75. package/dest/fixtures/web3signer.d.ts +1 -1
  76. package/dest/fixtures/web3signer.js +1 -1
  77. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  78. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  79. package/dest/fixtures/with_telemetry_utils.js +2 -2
  80. package/dest/index.d.ts +1 -1
  81. package/dest/quality_of_service/alert_checker.d.ts +1 -1
  82. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  83. package/dest/shared/cross_chain_test_harness.d.ts +5 -14
  84. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  85. package/dest/shared/cross_chain_test_harness.js +1 -1
  86. package/dest/shared/gas_portal_test_harness.d.ts +2 -12
  87. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  88. package/dest/shared/gas_portal_test_harness.js +1 -1
  89. package/dest/shared/index.d.ts +1 -1
  90. package/dest/shared/jest_setup.d.ts +1 -1
  91. package/dest/shared/submit-transactions.d.ts +1 -1
  92. package/dest/shared/submit-transactions.d.ts.map +1 -1
  93. package/dest/shared/uniswap_l1_l2.d.ts +4 -3
  94. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  95. package/dest/shared/uniswap_l1_l2.js +15 -13
  96. package/dest/simulators/index.d.ts +1 -1
  97. package/dest/simulators/lending_simulator.d.ts +2 -6
  98. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  99. package/dest/simulators/lending_simulator.js +5 -3
  100. package/dest/simulators/token_simulator.d.ts +1 -1
  101. package/dest/simulators/token_simulator.d.ts.map +1 -1
  102. package/dest/spartan/setup_test_wallets.d.ts +5 -3
  103. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  104. package/dest/spartan/setup_test_wallets.js +45 -10
  105. package/dest/spartan/tx_metrics.d.ts +39 -0
  106. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  107. package/dest/spartan/tx_metrics.js +95 -0
  108. package/dest/spartan/utils.d.ts +55 -20
  109. package/dest/spartan/utils.d.ts.map +1 -1
  110. package/dest/spartan/utils.js +203 -60
  111. package/package.json +42 -40
  112. package/src/bench/client_flows/client_flows_benchmark.ts +82 -34
  113. package/src/bench/client_flows/data_extractor.ts +6 -28
  114. package/src/bench/utils.ts +11 -7
  115. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +2 -2
  116. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +17 -12
  117. package/src/e2e_deploy_contract/deploy_test.ts +1 -1
  118. package/src/e2e_epochs/epochs_test.ts +37 -23
  119. package/src/e2e_fees/bridging_race.notest.ts +2 -2
  120. package/src/e2e_fees/fees_test.ts +22 -13
  121. package/src/e2e_l1_publisher/write_json.ts +5 -4
  122. package/src/e2e_multi_validator/utils.ts +1 -1
  123. package/src/e2e_nested_contract/nested_contract_test.ts +4 -3
  124. package/src/e2e_p2p/inactivity_slash_test.ts +5 -4
  125. package/src/e2e_p2p/p2p_network.ts +16 -19
  126. package/src/e2e_p2p/shared.ts +13 -6
  127. package/src/e2e_token_contract/token_contract_test.ts +2 -2
  128. package/src/fixtures/e2e_prover_test.ts +22 -25
  129. package/src/fixtures/fixtures.ts +2 -5
  130. package/src/fixtures/get_acvm_config.ts +1 -1
  131. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  132. package/src/fixtures/setup_p2p_test.ts +23 -9
  133. package/src/fixtures/snapshot_manager.ts +51 -65
  134. package/src/fixtures/token_utils.ts +4 -4
  135. package/src/fixtures/utils.ts +91 -131
  136. package/src/fixtures/web3signer.ts +1 -1
  137. package/src/fixtures/with_telemetry_utils.ts +2 -2
  138. package/src/guides/up_quick_start.sh +1 -1
  139. package/src/shared/cross_chain_test_harness.ts +5 -2
  140. package/src/shared/gas_portal_test_harness.ts +2 -2
  141. package/src/shared/uniswap_l1_l2.ts +19 -21
  142. package/src/simulators/lending_simulator.ts +6 -4
  143. package/src/spartan/DEVELOP.md +7 -0
  144. package/src/spartan/setup_test_wallets.ts +49 -12
  145. package/src/spartan/tx_metrics.ts +130 -0
  146. package/src/spartan/utils.ts +267 -51
  147. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  148. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  149. package/dest/fixtures/setup_l1_contracts.js +0 -17
  150. package/src/fixtures/setup_l1_contracts.ts +0 -26
@@ -5,26 +5,23 @@ 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
- import { createBlobSinkClient } from '@aztec/blob-sink/client';
13
- import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
14
- import { GENESIS_ARCHIVE_ROOT, SPONSORED_FPC_SALT } from '@aztec/constants';
13
+ import { type BlobClientInterface, createBlobClientWithFileStores } from '@aztec/blob-client/client';
14
+ import { SPONSORED_FPC_SALT } from '@aztec/constants';
15
+ import { isAnvilTestChain } from '@aztec/ethereum/chain';
16
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
17
+ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
18
+ import { NULL_KEY } from '@aztec/ethereum/constants';
15
19
  import {
16
- type DeployL1ContractsArgs,
17
- type DeployL1ContractsReturnType,
18
- FeeAssetArtifact,
19
- NULL_KEY,
20
+ type DeployAztecL1ContractsReturnType,
20
21
  type Operator,
21
- RollupContract,
22
- createExtendedL1Client,
23
- deployL1Contracts,
24
- deployMulticall3,
25
- getL1ContractsConfigEnvVars,
26
- isAnvilTestChain,
27
- } from '@aztec/ethereum';
22
+ type ZKPassportArgs,
23
+ deployAztecL1Contracts,
24
+ } from '@aztec/ethereum/deploy-aztec-l1-contracts';
28
25
  import {
29
26
  DelayedTxUtils,
30
27
  EthCheatCodes,
@@ -32,10 +29,9 @@ import {
32
29
  createDelayedL1TxUtilsFromViemWallet,
33
30
  startAnvil,
34
31
  } from '@aztec/ethereum/test';
32
+ import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
35
33
  import { SecretValue } from '@aztec/foundation/config';
36
- import { randomBytes } from '@aztec/foundation/crypto';
37
34
  import { EthAddress } from '@aztec/foundation/eth-address';
38
- import { Fr } from '@aztec/foundation/fields';
39
35
  import { tryRmDir } from '@aztec/foundation/fs';
40
36
  import { withLogNameSuffix } from '@aztec/foundation/log';
41
37
  import { retryUntil } from '@aztec/foundation/retry';
@@ -71,13 +67,19 @@ import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/serv
71
67
  import { getGenesisValues } from '@aztec/world-state/testing';
72
68
 
73
69
  import type { Anvil } from '@viem/anvil';
70
+ import { randomBytes } from 'crypto';
74
71
  import fs from 'fs/promises';
75
- import getPort from 'get-port';
76
72
  import { tmpdir } from 'os';
77
73
  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';
74
+ import type { Hex } from 'viem';
75
+ import {
76
+ type HDAccount,
77
+ type PrivateKeyAccount,
78
+ generatePrivateKey,
79
+ mnemonicToAccount,
80
+ privateKeyToAccount,
81
+ } from 'viem/accounts';
82
+ import { type Chain, foundry } from 'viem/chains';
81
83
 
82
84
  import { MNEMONIC, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
83
85
  import { getACVMConfig } from './get_acvm_config.js';
@@ -87,14 +89,24 @@ import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
87
89
  export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
88
90
  export { startAnvil };
89
91
 
92
+ /**
93
+ * Sets up shared blob storage using FileStore in the data directory.
94
+ */
95
+ export async function setupSharedBlobStorage(config: { dataDirectory?: string } & Record<string, any>): Promise<void> {
96
+ const sharedBlobPath = path.join(config.dataDirectory!, 'shared-blobs');
97
+ await fs.mkdir(sharedBlobPath, { recursive: true });
98
+ config.blobFileStoreUrls = [`file://${sharedBlobPath}`];
99
+ config.blobFileStoreUploadUrl = `file://${sharedBlobPath}`;
100
+ }
101
+
90
102
  const { AZTEC_NODE_URL = '' } = process.env;
91
103
  const getAztecUrl = () => AZTEC_NODE_URL;
92
104
 
93
105
  let telemetry: TelemetryClient | undefined = undefined;
94
- function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
106
+ async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
95
107
  if (!telemetry) {
96
108
  const config = { ...getTelemetryConfig(), ...partialConfig };
97
- telemetry = config.benchmark ? new BenchmarkTelemetryClient() : initTelemetryClient(config);
109
+ telemetry = config.benchmark ? new BenchmarkTelemetryClient() : await initTelemetryClient(config);
98
110
  }
99
111
  return telemetry;
100
112
  }
@@ -110,27 +122,6 @@ export const getPrivateKeyFromIndex = (index: number): Buffer | null => {
110
122
  return privKeyRaw === null ? null : Buffer.from(privKeyRaw);
111
123
  };
112
124
 
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(l1RpcUrls, account, chain, logger, {
121
- vkTreeRoot: getVKTreeRoot(),
122
- protocolContractsHash,
123
- genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
124
- salt: args.salt,
125
- initialValidators: args.initialValidators,
126
- ...getL1ContractsConfigEnvVars(),
127
- realVerifier: false,
128
- ...args,
129
- });
130
-
131
- return l1Data;
132
- };
133
-
134
125
  /**
135
126
  * Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
136
127
  * @param aztecNode - An instance of Aztec Node.
@@ -207,7 +198,7 @@ async function setupWithRemoteEnvironment(
207
198
 
208
199
  const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
209
200
 
210
- const deployL1ContractsValues: DeployL1ContractsReturnType = {
201
+ const deployL1ContractsValues: DeployAztecL1ContractsReturnType = {
211
202
  l1ContractAddresses,
212
203
  l1Client,
213
204
  rollupVersion,
@@ -249,8 +240,8 @@ async function setupWithRemoteEnvironment(
249
240
  mockGossipSubNetwork: undefined,
250
241
  watcher: undefined,
251
242
  dateProvider: undefined,
252
- blobSink: undefined,
253
243
  telemetryClient: undefined,
244
+ blobClient: undefined,
254
245
  teardown,
255
246
  };
256
247
  }
@@ -262,17 +253,13 @@ export type SetupOptions = {
262
253
  /** Whether to enable metrics collection, if undefined, metrics collection is disabled */
263
254
  metricsPort?: number | undefined;
264
255
  /** Previously deployed contracts on L1 */
265
- deployL1ContractsValues?: DeployL1ContractsReturnType;
266
- /** Whether to skip deployment of protocol contracts (auth registry, etc) */
267
- skipProtocolContracts?: boolean;
256
+ deployL1ContractsValues?: DeployAztecL1ContractsReturnType;
268
257
  /** Initial fee juice for default accounts */
269
258
  initialAccountFeeJuice?: Fr;
270
259
  /** Number of initial accounts funded with fee juice */
271
260
  numberOfInitialFundedAccounts?: number;
272
261
  /** Data of the initial funded accounts */
273
262
  initialFundedAccounts?: InitialAccountData[];
274
- /** Salt to use in L1 contract deployment */
275
- salt?: number;
276
263
  /** An initial set of validators */
277
264
  initialValidators?: (Operator & { privateKey: `0x${string}` })[];
278
265
  /** Anvil Start time */
@@ -281,8 +268,6 @@ export type SetupOptions = {
281
268
  l2StartTime?: number;
282
269
  /** Whether to start a prover node */
283
270
  startProverNode?: boolean;
284
- /** Whether to fund the rewardDistributor */
285
- fundRewardDistributor?: boolean;
286
271
  /** Manual config for the telemetry client */
287
272
  telemetryConfig?: Partial<TelemetryClientConfig> & { benchmark?: boolean };
288
273
  /** Public data that will be inserted in the tree in genesis */
@@ -301,6 +286,8 @@ export type SetupOptions = {
301
286
  anvilPort?: number;
302
287
  /** Key to use for publishing L1 contracts */
303
288
  l1PublisherKey?: SecretValue<`0x${string}`>;
289
+ /** ZkPassport configuration (domain, scope, mock verifier) */
290
+ zkPassportArgs?: ZKPassportArgs;
304
291
  } & Partial<AztecNodeConfig>;
305
292
 
306
293
  /** Context for an end-to-end test as returned by the `setup` function */
@@ -313,8 +300,8 @@ export type EndToEndContext = {
313
300
  proverNode: ProverNode | undefined;
314
301
  /** A client to the sequencer service (undefined if connected to remote environment) */
315
302
  sequencer: SequencerClient | undefined;
316
- /** Return values from deployL1Contracts function. */
317
- deployL1ContractsValues: DeployL1ContractsReturnType;
303
+ /** Return values from deployAztecL1Contracts function. */
304
+ deployL1ContractsValues: DeployAztecL1ContractsReturnType;
318
305
  /** The Aztec Node configuration. */
319
306
  config: AztecNodeConfig;
320
307
  /** The data for the initial funded accounts. */
@@ -333,14 +320,14 @@ export type EndToEndContext = {
333
320
  watcher: AnvilTestWatcher | undefined;
334
321
  /** Allows tweaking current system time, used by the epoch cache only (undefined if connected to remote environment) */
335
322
  dateProvider: TestDateProvider | undefined;
336
- /** The blob sink (undefined if connected to remote environment) */
337
- blobSink: BlobSinkServer | undefined;
338
323
  /** Telemetry client */
339
324
  telemetryClient: TelemetryClient | undefined;
340
325
  /** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
341
326
  mockGossipSubNetwork: MockGossipSubNetwork | undefined;
342
327
  /** Prefilled public data used for setting up nodes. */
343
328
  prefilledPublicData: PublicDataTreeLeaf[] | undefined;
329
+ /** The blob client client used for blob storage (undefined if connected to remote environment) */
330
+ blobClient: BlobClientInterface | undefined;
344
331
  /** Function to stop the started services. */
345
332
  teardown: () => Promise<void>;
346
333
  };
@@ -418,27 +405,32 @@ export async function setup(
418
405
  await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
419
406
  }
420
407
 
421
- let publisherPrivKey = undefined;
422
- let publisherHdAccount = undefined;
408
+ let publisherPrivKeyHex: `0x${string}` | undefined = undefined;
409
+ let publisherHdAccount: HDAccount | PrivateKeyAccount | undefined = undefined;
423
410
 
424
411
  if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
425
- publisherHdAccount = privateKeyToAccount(opts.l1PublisherKey.getValue());
412
+ publisherPrivKeyHex = opts.l1PublisherKey.getValue();
413
+ publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
426
414
  } else if (
427
415
  config.publisherPrivateKeys &&
428
416
  config.publisherPrivateKeys.length > 0 &&
429
417
  config.publisherPrivateKeys[0].getValue() != NULL_KEY
430
418
  ) {
431
- publisherHdAccount = privateKeyToAccount(config.publisherPrivateKeys[0].getValue());
419
+ publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
420
+ publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
432
421
  } else if (!MNEMONIC) {
433
422
  throw new Error(`Mnemonic not provided and no publisher private key`);
434
423
  } else {
435
424
  publisherHdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: 0 });
436
425
  const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
437
- publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
438
- config.publisherPrivateKeys = [new SecretValue(`0x${publisherPrivKey!.toString('hex')}` as const)];
426
+ const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
427
+ publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
428
+ config.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
439
429
  }
440
430
 
441
- config.coinbase = EthAddress.fromString(publisherHdAccount.address);
431
+ if (config.coinbase === undefined) {
432
+ config.coinbase = EthAddress.fromString(publisherHdAccount.address);
433
+ }
442
434
 
443
435
  if (AZTEC_NODE_URL) {
444
436
  // we are setting up against a remote environment, l1 contracts are assumed to already be deployed
@@ -461,51 +453,26 @@ export async function setup(
461
453
  }
462
454
 
463
455
  const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount!, chain);
464
- await deployMulticall3(l1Client, logger);
465
-
466
- const deployL1ContractsValues =
467
- opts.deployL1ContractsValues ??
468
- (await setupL1Contracts(
469
- config.l1RpcUrls,
470
- publisherHdAccount!,
471
- logger,
472
- {
473
- ...opts,
474
- genesisArchiveRoot,
475
- feeJuicePortalInitialBalance: fundingNeeded,
476
- initialValidators: opts.initialValidators,
477
- },
478
- chain,
479
- ));
456
+
457
+ const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await deployAztecL1Contracts(
458
+ config.l1RpcUrls[0],
459
+ publisherPrivKeyHex!,
460
+ chain.id,
461
+ {
462
+ ...getL1ContractsConfigEnvVars(),
463
+ ...opts,
464
+ vkTreeRoot: getVKTreeRoot(),
465
+ protocolContractsHash,
466
+ genesisArchiveRoot,
467
+ initialValidators: opts.initialValidators,
468
+ feeJuicePortalInitialBalance: fundingNeeded,
469
+ realVerifier: false,
470
+ },
471
+ );
480
472
 
481
473
  config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
482
474
  config.rollupVersion = deployL1ContractsValues.rollupVersion;
483
475
 
484
- if (opts.fundRewardDistributor) {
485
- // Mints block rewards for 10000 blocks to the rewardDistributor contract
486
-
487
- const rollup = new RollupContract(
488
- deployL1ContractsValues.l1Client,
489
- deployL1ContractsValues.l1ContractAddresses.rollupAddress,
490
- );
491
-
492
- const blockReward = await rollup.getBlockReward();
493
- const mintAmount = 10_000n * (blockReward as bigint);
494
-
495
- const feeJuice = getContract({
496
- address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
497
- abi: FeeAssetArtifact.contractAbi,
498
- client: deployL1ContractsValues.l1Client,
499
- });
500
-
501
- const rewardDistributorMintTxHash = await feeJuice.write.mint(
502
- [deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(), mintAmount],
503
- {} as any,
504
- );
505
- await deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: rewardDistributorMintTxHash });
506
- logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
507
- }
508
-
509
476
  if (enableAutomine) {
510
477
  await ethCheatCodes.setAutomine(false);
511
478
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
@@ -528,23 +495,9 @@ export async function setup(
528
495
  await watcher.start();
529
496
  }
530
497
 
531
- const telemetry = getTelemetryClient(opts.telemetryConfig);
498
+ const telemetry = await getTelemetryClient(opts.telemetryConfig);
532
499
 
533
- // Blob sink service - blobs get posted here and served from here
534
- const blobSinkPort = await getPort();
535
- const blobSink = await createBlobSinkServer(
536
- {
537
- l1ChainId: config.l1ChainId,
538
- l1RpcUrls: config.l1RpcUrls,
539
- l1Contracts: config.l1Contracts,
540
- port: blobSinkPort,
541
- dataDirectory: config.dataDirectory,
542
- dataStoreMapSizeKb: config.dataStoreMapSizeKb,
543
- },
544
- telemetry,
545
- );
546
- await blobSink.start();
547
- config.blobSinkUrl = `http://localhost:${blobSinkPort}`;
500
+ await setupSharedBlobStorage(config);
548
501
 
549
502
  logger.verbose('Creating and synching an aztec node', config);
550
503
 
@@ -560,7 +513,7 @@ export async function setup(
560
513
  config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
561
514
  }
562
515
 
563
- const blobSinkClient = createBlobSinkClient(config, { logger: createLogger('node:blob-sink:client') });
516
+ const blobClient = await createBlobClientWithFileStores(config, createLogger('node:blob-client:client'));
564
517
 
565
518
  let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
566
519
  let p2pClientDeps: P2PClientDeps<P2PClientType.Full> | undefined = undefined;
@@ -600,7 +553,7 @@ export async function setup(
600
553
 
601
554
  const aztecNode = await AztecNodeService.createAndSync(
602
555
  config, // REFACTOR: createAndSync mutates this config
603
- { dateProvider, blobSinkClient, telemetry, p2pClientDeps, logger: createLogger('node:MAIN-aztec-node') },
556
+ { dateProvider, blobClient, telemetry, p2pClientDeps, logger: createLogger('node:MAIN-aztec-node') },
604
557
  { prefilledPublicData },
605
558
  );
606
559
  const sequencerClient = aztecNode.getSequencer();
@@ -636,7 +589,11 @@ export async function setup(
636
589
  (opts.initialValidators && opts.initialValidators.length > 0)
637
590
  ) {
638
591
  // We need to advance such that the committee is set up.
639
- await cheatCodes.rollup.advanceToEpoch((await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochs + 1));
592
+ await cheatCodes.rollup.advanceToEpoch(
593
+ EpochNumber.fromBigInt(
594
+ BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1),
595
+ ),
596
+ );
640
597
  await cheatCodes.rollup.setupEpoch();
641
598
  await cheatCodes.rollup.debugRollup();
642
599
  }
@@ -684,7 +641,6 @@ export async function setup(
684
641
  await tryStop(watcher, logger);
685
642
  await tryStop(anvil, logger);
686
643
 
687
- await tryStop(blobSink, logger);
688
644
  await tryRmDir(directoryToCleanup, logger);
689
645
  } catch (err) {
690
646
  logger.error(`Error during e2e test teardown`, err);
@@ -694,7 +650,6 @@ export async function setup(
694
650
  return {
695
651
  aztecNode,
696
652
  aztecNodeAdmin: aztecNode,
697
- blobSink,
698
653
  cheatCodes,
699
654
  ethCheatCodes,
700
655
  config,
@@ -711,6 +666,7 @@ export async function setup(
711
666
  wallet,
712
667
  accounts,
713
668
  watcher,
669
+ blobClient,
714
670
  };
715
671
  } catch (err) {
716
672
  // TODO: Just hoisted anvil for now to ensure cleanup. Prob need to hoist the rest.
@@ -728,7 +684,7 @@ export async function setup(
728
684
 
729
685
  export async function ensureAccountContractsPublished(wallet: Wallet, accountsToDeploy: AztecAddress[]) {
730
686
  // We have to check whether the accounts are already deployed. This can happen if the test runs against
731
- // the sandbox and the test accounts exist
687
+ // the local network and the test accounts exist
732
688
  const accountsAndAddresses = await Promise.all(
733
689
  accountsToDeploy.map(async address => {
734
690
  return {
@@ -848,7 +804,7 @@ export async function setupSponsoredFPC(wallet: Wallet) {
848
804
  salt: new Fr(SPONSORED_FPC_SALT),
849
805
  });
850
806
 
851
- await wallet.registerContract({ instance, artifact: SponsoredFPCContract.artifact });
807
+ await wallet.registerContract(instance, SponsoredFPCContract.artifact);
852
808
  getLogger().info(`SponsoredFPC: ${instance.address}`);
853
809
  return instance;
854
810
  }
@@ -858,10 +814,10 @@ export async function setupSponsoredFPC(wallet: Wallet) {
858
814
  * @param wallet - The wallet
859
815
  */
860
816
  export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
861
- await wallet.registerContract({ instance: await getSponsoredFPCInstance(), artifact: SponsoredFPCContract.artifact });
817
+ await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
862
818
  }
863
819
 
864
- export async function waitForProvenChain(node: AztecNode, targetBlock?: number, timeoutSec = 60, intervalSec = 1) {
820
+ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNumber, timeoutSec = 60, intervalSec = 1) {
865
821
  targetBlock ??= await node.getBlockNumber();
866
822
 
867
823
  await retryUntil(
@@ -889,11 +845,15 @@ export function createAndSyncProverNode(
889
845
  stop: () => Promise.resolve(),
890
846
  };
891
847
 
892
- const blobSinkClient = createBlobSinkClient(aztecNodeConfig);
848
+ const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('blob-client:prover-node'));
893
849
 
894
850
  // Creating temp store and archiver for simulated prover node
895
851
  const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
896
- const archiver = await createArchiver(archiverConfig, { blobSinkClient }, { blockUntilSync: true });
852
+ const archiver = await createArchiver(
853
+ archiverConfig,
854
+ { blobClient, dateProvider: proverNodeDeps.dateProvider },
855
+ { blockUntilSync: true },
856
+ );
897
857
 
898
858
  // Prover node config is for simulated proofs
899
859
  const proverConfig: ProverNodeConfig = {
@@ -1,4 +1,4 @@
1
- import { randomBytes } from '@aztec/foundation/crypto';
1
+ import { randomBytes } from '@aztec/foundation/crypto/random';
2
2
  import { retryUntil } from '@aztec/foundation/retry';
3
3
  import { sleep } from '@aztec/foundation/sleep';
4
4
  import { RemoteSigner } from '@aztec/node-keystore';
@@ -7,12 +7,12 @@ import {
7
7
  } from '@aztec/telemetry-client';
8
8
  import { OTelPinoStream } from '@aztec/telemetry-client/otel-pino-stream';
9
9
 
10
- export function getEndToEndTestTelemetryClient(metricsPort?: number): TelemetryClient {
10
+ export async function getEndToEndTestTelemetryClient(metricsPort?: number): Promise<TelemetryClient> {
11
11
  if (metricsPort) {
12
12
  const otelStream = new OTelPinoStream({ levels });
13
13
  registerLoggingStream(otelStream);
14
14
  }
15
- return initTelemetryClient(getEndToEndTestTelemetryConfig(metricsPort));
15
+ return await initTelemetryClient(getEndToEndTestTelemetryConfig(metricsPort));
16
16
  }
17
17
 
18
18
  /**
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # Run locally from end-to-end folder while running anvil and sandbox with:
2
+ # Run locally from end-to-end folder while running anvil and local network with:
3
3
  # PATH=$PATH:../node_modules/.bin ./src/guides/up_quick_start.sh
4
4
  set -eux
5
5
 
@@ -13,7 +13,10 @@ 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 { type ExtendedViemWalletClient, type L1ContractAddresses, deployL1Contract } from '@aztec/ethereum';
16
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
17
+ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
18
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
19
+ import { BlockNumber } from '@aztec/foundation/branded-types';
17
20
  import { retryUntil } from '@aztec/foundation/retry';
18
21
  import type { FieldsOf } from '@aztec/foundation/types';
19
22
  import { TestERC20Abi, TokenPortalAbi, TokenPortalBytecode } from '@aztec/l1-artifacts';
@@ -321,7 +324,7 @@ export class CrossChainTestHarness {
321
324
 
322
325
  withdrawFundsFromBridgeOnL1(
323
326
  amount: bigint,
324
- blockNumber: number | bigint,
327
+ blockNumber: BlockNumber,
325
328
  messageIndex: bigint,
326
329
  siblingPath: SiblingPath<number>,
327
330
  ) {
@@ -4,7 +4,7 @@ import { Fr } from '@aztec/aztec.js/fields';
4
4
  import type { Logger } from '@aztec/aztec.js/log';
5
5
  import type { AztecNode } from '@aztec/aztec.js/node';
6
6
  import type { Wallet } from '@aztec/aztec.js/wallet';
7
- import type { ExtendedViemWalletClient } from '@aztec/ethereum';
7
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
8
8
  import { retryUntil } from '@aztec/foundation/retry';
9
9
  import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
10
10
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
@@ -43,7 +43,7 @@ export class FeeJuicePortalTestingHarnessFactory {
43
43
  throw new Error('Fee Juice portal not deployed on L1');
44
44
  }
45
45
 
46
- const gasL2 = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, wallet);
46
+ const gasL2 = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, wallet);
47
47
 
48
48
  return new GasBridgingTestHarness(
49
49
  aztecNode,
@@ -5,14 +5,12 @@ import { Fr } from '@aztec/aztec.js/fields';
5
5
  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
- import {
9
- type DeployL1ContractsReturnType,
10
- type ExtendedViemWalletClient,
11
- RollupContract,
12
- deployL1Contract,
13
- extractEvent,
14
- } from '@aztec/ethereum';
15
- import { sha256ToField } from '@aztec/foundation/crypto';
8
+ import { RollupContract } from '@aztec/ethereum/contracts';
9
+ import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
10
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
11
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
12
+ import { extractEvent } from '@aztec/ethereum/utils';
13
+ import { sha256ToField } from '@aztec/foundation/crypto/sha256';
16
14
  import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
17
15
  import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
18
16
  import { computeL2ToL1MessageHash } from '@aztec/stdlib/hash';
@@ -49,7 +47,7 @@ export type UniswapSetupContext = {
49
47
  /** The sponsor wallet. */
50
48
  sponsorAddress: AztecAddress;
51
49
  /** */
52
- deployL1ContractsValues: DeployL1ContractsReturnType;
50
+ deployL1ContractsValues: DeployAztecL1ContractsReturnType;
53
51
  /** Cheat codes instance. */
54
52
  cheatCodes: CheatCodes;
55
53
  };
@@ -79,7 +77,7 @@ export const uniswapL1L2TestSuite = (
79
77
  let daiCrossChainHarness: CrossChainTestHarness;
80
78
  let wethCrossChainHarness: CrossChainTestHarness;
81
79
 
82
- let deployL1ContractsValues: DeployL1ContractsReturnType;
80
+ let deployL1ContractsValues: DeployAztecL1ContractsReturnType;
83
81
  let rollup: RollupContract;
84
82
  let uniswapPortal: GetContractReturnType<typeof UniswapPortalAbi, ExtendedViemWalletClient>;
85
83
  let uniswapPortalAddress: EthAddress;
@@ -262,7 +260,7 @@ export const uniswapL1L2TestSuite = (
262
260
  await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
263
261
 
264
262
  // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
265
- await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
263
+ await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
266
264
 
267
265
  // 5. Consume L2 to L1 message by calling uniswapPortal.swap_private()
268
266
  logger.info('Execute withdraw and swap on the uniswapPortal!');
@@ -287,7 +285,7 @@ export const uniswapL1L2TestSuite = (
287
285
  const withdrawSiblingPath = withdrawResult!.siblingPath;
288
286
 
289
287
  const withdrawMessageMetadata = {
290
- _l2BlockNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
288
+ _checkpointNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
291
289
  _leafIndex: BigInt(withdrawL2MessageIndex),
292
290
  _path: withdrawSiblingPath
293
291
  .toBufferArray()
@@ -295,7 +293,7 @@ export const uniswapL1L2TestSuite = (
295
293
  };
296
294
 
297
295
  const swapPrivateMessageMetadata = {
298
- _l2BlockNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
296
+ _checkpointNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
299
297
  _leafIndex: BigInt(swapPrivateL2MessageIndex),
300
298
  _path: swapPrivateSiblingPath
301
299
  .toBufferArray()
@@ -506,7 +504,7 @@ export const uniswapL1L2TestSuite = (
506
504
  // );
507
505
 
508
506
  // const withdrawMessageMetadata = {
509
- // _l2BlockNumber: BigInt(uniswapL2Interaction.blockNumber!),
507
+ // _checkpointNumber: BigInt(uniswapL2Interaction.blockNumber!),
510
508
  // _leafIndex: BigInt(withdrawL2MessageIndex),
511
509
  // _path: withdrawSiblingPath
512
510
  // .toBufferArray()
@@ -514,7 +512,7 @@ export const uniswapL1L2TestSuite = (
514
512
  // };
515
513
 
516
514
  // const swapPrivateMessageMetadata = {
517
- // _l2BlockNumber: BigInt(uniswapL2Interaction.blockNumber!),
515
+ // _checkpointNumber: BigInt(uniswapL2Interaction.blockNumber!),
518
516
  // _leafIndex: BigInt(swapPrivateL2MessageIndex),
519
517
  // _path: swapPrivateSiblingPath
520
518
  // .toBufferArray()
@@ -872,7 +870,7 @@ export const uniswapL1L2TestSuite = (
872
870
  const withdrawSiblingPath = withdrawResult!.siblingPath;
873
871
 
874
872
  const withdrawMessageMetadata = {
875
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
873
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
876
874
  _leafIndex: BigInt(withdrawL2MessageIndex),
877
875
  _path: withdrawSiblingPath
878
876
  .toBufferArray()
@@ -880,7 +878,7 @@ export const uniswapL1L2TestSuite = (
880
878
  };
881
879
 
882
880
  const swapPrivateMessageMetadata = {
883
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
881
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
884
882
  _leafIndex: BigInt(swapPrivateL2MessageIndex),
885
883
  _path: swapPrivateSiblingPath
886
884
  .toBufferArray()
@@ -891,7 +889,7 @@ export const uniswapL1L2TestSuite = (
891
889
  await wethCrossChainHarness.expectPrivateBalanceOnL2(ownerAddress, wethL2BalanceBeforeSwap - wethAmountToBridge);
892
890
 
893
891
  // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
894
- await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
892
+ await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
895
893
 
896
894
  // On L1 call swap_public!
897
895
  logger.info('call swap_public on L1');
@@ -1007,7 +1005,7 @@ export const uniswapL1L2TestSuite = (
1007
1005
  const withdrawSiblingPath = withdrawResult!.siblingPath;
1008
1006
 
1009
1007
  const withdrawMessageMetadata = {
1010
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
1008
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
1011
1009
  _leafIndex: BigInt(withdrawL2MessageIndex),
1012
1010
  _path: withdrawSiblingPath
1013
1011
  .toBufferArray()
@@ -1015,7 +1013,7 @@ export const uniswapL1L2TestSuite = (
1015
1013
  };
1016
1014
 
1017
1015
  const swapPublicMessageMetadata = {
1018
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
1016
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
1019
1017
  _leafIndex: BigInt(swapPublicL2MessageIndex),
1020
1018
  _path: swapPublicSiblingPath
1021
1019
  .toBufferArray()
@@ -1026,7 +1024,7 @@ export const uniswapL1L2TestSuite = (
1026
1024
  await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
1027
1025
 
1028
1026
  // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
1029
- await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
1027
+ await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
1030
1028
 
1031
1029
  // Call swap_private on L1
1032
1030
  logger.info('Execute withdraw and swap on the uniswapPortal!');