@aztec/end-to-end 0.0.1-commit.9b94fc1 → 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 (98) 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 +5 -3
  4. package/dest/bench/utils.d.ts +2 -2
  5. package/dest/bench/utils.d.ts.map +1 -1
  6. package/dest/bench/utils.js +10 -6
  7. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +5 -4
  8. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  9. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +2 -1
  10. package/dest/e2e_epochs/epochs_test.d.ts +11 -9
  11. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  12. package/dest/e2e_epochs/epochs_test.js +13 -11
  13. package/dest/e2e_fees/bridging_race.notest.js +1 -1
  14. package/dest/e2e_fees/fees_test.d.ts +8 -4
  15. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  16. package/dest/e2e_fees/fees_test.js +4 -1
  17. package/dest/e2e_multi_validator/utils.js +1 -1
  18. package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
  19. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  20. package/dest/e2e_p2p/inactivity_slash_test.js +3 -6
  21. package/dest/e2e_p2p/p2p_network.d.ts +7 -6
  22. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  23. package/dest/e2e_p2p/p2p_network.js +10 -8
  24. package/dest/e2e_p2p/shared.d.ts +2 -2
  25. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  26. package/dest/fixtures/e2e_prover_test.d.ts +3 -5
  27. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  28. package/dest/fixtures/e2e_prover_test.js +6 -9
  29. package/dest/fixtures/fixtures.d.ts +2 -3
  30. package/dest/fixtures/fixtures.d.ts.map +1 -1
  31. package/dest/fixtures/fixtures.js +2 -3
  32. package/dest/fixtures/get_acvm_config.js +1 -1
  33. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  34. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  35. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  36. package/dest/fixtures/setup_p2p_test.js +3 -3
  37. package/dest/fixtures/snapshot_manager.d.ts +6 -8
  38. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  39. package/dest/fixtures/snapshot_manager.js +34 -46
  40. package/dest/fixtures/utils.d.ts +20 -463
  41. package/dest/fixtures/utils.d.ts.map +1 -1
  42. package/dest/fixtures/utils.js +50 -78
  43. package/dest/fixtures/web3signer.js +1 -1
  44. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  45. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  46. package/dest/fixtures/with_telemetry_utils.js +2 -2
  47. package/dest/shared/cross_chain_test_harness.d.ts +5 -3
  48. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  49. package/dest/shared/cross_chain_test_harness.js +1 -1
  50. package/dest/shared/gas_portal_test_harness.d.ts +2 -2
  51. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  52. package/dest/shared/uniswap_l1_l2.d.ts +4 -3
  53. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  54. package/dest/shared/uniswap_l1_l2.js +4 -2
  55. package/dest/simulators/lending_simulator.d.ts +2 -2
  56. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  57. package/dest/simulators/lending_simulator.js +1 -1
  58. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  59. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  60. package/dest/spartan/setup_test_wallets.js +2 -1
  61. package/dest/spartan/tx_metrics.d.ts +39 -0
  62. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  63. package/dest/spartan/tx_metrics.js +95 -0
  64. package/dest/spartan/utils.d.ts +45 -10
  65. package/dest/spartan/utils.d.ts.map +1 -1
  66. package/dest/spartan/utils.js +203 -60
  67. package/package.json +40 -40
  68. package/src/bench/client_flows/client_flows_benchmark.ts +7 -4
  69. package/src/bench/utils.ts +11 -7
  70. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +13 -9
  71. package/src/e2e_epochs/epochs_test.ts +33 -20
  72. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  73. package/src/e2e_fees/fees_test.ts +10 -4
  74. package/src/e2e_multi_validator/utils.ts +1 -1
  75. package/src/e2e_p2p/inactivity_slash_test.ts +4 -7
  76. package/src/e2e_p2p/p2p_network.ts +9 -16
  77. package/src/e2e_p2p/shared.ts +5 -1
  78. package/src/fixtures/e2e_prover_test.ts +8 -10
  79. package/src/fixtures/fixtures.ts +2 -5
  80. package/src/fixtures/get_acvm_config.ts +1 -1
  81. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  82. package/src/fixtures/setup_p2p_test.ts +3 -3
  83. package/src/fixtures/snapshot_manager.ts +51 -65
  84. package/src/fixtures/utils.ts +79 -138
  85. package/src/fixtures/web3signer.ts +1 -1
  86. package/src/fixtures/with_telemetry_utils.ts +2 -2
  87. package/src/shared/cross_chain_test_harness.ts +5 -2
  88. package/src/shared/gas_portal_test_harness.ts +1 -1
  89. package/src/shared/uniswap_l1_l2.ts +8 -10
  90. package/src/simulators/lending_simulator.ts +2 -2
  91. package/src/spartan/DEVELOP.md +7 -0
  92. package/src/spartan/setup_test_wallets.ts +2 -1
  93. package/src/spartan/tx_metrics.ts +130 -0
  94. package/src/spartan/utils.ts +267 -51
  95. package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
  96. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  97. package/dest/fixtures/setup_l1_contracts.js +0 -17
  98. package/src/fixtures/setup_l1_contracts.ts +0 -26
@@ -6,16 +6,21 @@ import { getContractClassFromArtifact } from '@aztec/aztec.js/contracts';
6
6
  import { BatchCall, waitForProven } from '@aztec/aztec.js/contracts';
7
7
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
8
8
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
9
- import { createBlobSinkServer } from '@aztec/blob-sink/server';
10
- import { createExtendedL1Client, deployMulticall3, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
9
+ import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
10
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
11
+ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
12
+ import { deployMulticall3 } from '@aztec/ethereum/contracts';
13
+ import { deployAztecL1Contracts } from '@aztec/ethereum/deploy-aztec-l1-contracts';
11
14
  import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
12
15
  import { asyncMap } from '@aztec/foundation/async-map';
13
16
  import { SecretValue } from '@aztec/foundation/config';
14
- import { randomBytes } from '@aztec/foundation/crypto';
17
+ import { randomBytes } from '@aztec/foundation/crypto/random';
15
18
  import { tryRmDir } from '@aztec/foundation/fs';
16
19
  import { createLogger } from '@aztec/foundation/log';
17
20
  import { resolver, reviver } from '@aztec/foundation/serialize';
18
21
  import { TestDateProvider } from '@aztec/foundation/timer';
22
+ import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
23
+ import { protocolContractsHash } from '@aztec/protocol-contracts';
19
24
  import { getPXEConfig } from '@aztec/pxe/server';
20
25
  import { tryStop } from '@aztec/stdlib/interfaces/server';
21
26
  import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
@@ -24,16 +29,14 @@ import { getGenesisValues } from '@aztec/world-state/testing';
24
29
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
25
30
  import { copySync, removeSync } from 'fs-extra/esm';
26
31
  import fs from 'fs/promises';
27
- import getPort from 'get-port';
28
32
  import { tmpdir } from 'os';
29
33
  import path, { join } from 'path';
30
34
  import { mnemonicToAccount } from 'viem/accounts';
31
35
  import { foundry } from 'viem/chains';
32
- import { MNEMONIC, TEST_MAX_TX_POOL_SIZE, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
36
+ import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
33
37
  import { getACVMConfig } from './get_acvm_config.js';
34
38
  import { getBBConfig } from './get_bb_config.js';
35
- import { setupL1Contracts } from './setup_l1_contracts.js';
36
- import { createAndSyncProverNode, getLogger, getPrivateKeyFromIndex, getSponsoredFPCAddress } from './utils.js';
39
+ import { createAndSyncProverNode, getLogger, getPrivateKeyFromIndex, getSponsoredFPCAddress, setupSharedBlobStorage } from './utils.js';
37
40
  import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
38
41
  export function createSnapshotManager(testName, dataPath, config = {}, deployL1ContractsArgs = {
39
42
  initialValidators: []
@@ -192,7 +195,6 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
192
195
  await context.bbConfig?.cleanup();
193
196
  await tryStop(context.anvil);
194
197
  await tryStop(context.watcher);
195
- await tryStop(context.blobSink);
196
198
  await tryRmDir(context.directoryToCleanup, logger);
197
199
  } catch (err) {
198
200
  logger.error('Error during teardown', err);
@@ -206,7 +208,6 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
206
208
  initialValidators: []
207
209
  }) {
208
210
  logger.verbose(`Initializing state...`);
209
- const blobSinkPort = await getPort();
210
211
  // Default to no slashing
211
212
  opts.slasherFlavor ??= 'none';
212
213
  deployL1ContractsArgs.slasherFlavor ??= opts.slasherFlavor;
@@ -217,7 +218,7 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
217
218
  ...opts
218
219
  };
219
220
  aztecNodeConfig.peerCheckIntervalMS = TEST_PEER_CHECK_INTERVAL_MS;
220
- aztecNodeConfig.maxTxPoolSize = opts.maxTxPoolSize ?? TEST_MAX_TX_POOL_SIZE;
221
+ aztecNodeConfig.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
221
222
  // Only enable proving if specifically requested.
222
223
  aztecNodeConfig.realProofs = !!opts.realProofs;
223
224
  // Only enforce the time table if requested
@@ -236,19 +237,20 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
236
237
  } else {
237
238
  aztecNodeConfig.dataDirectory = statePath;
238
239
  }
239
- aztecNodeConfig.blobSinkUrl = `http://127.0.0.1:${blobSinkPort}`;
240
+ await setupSharedBlobStorage(aztecNodeConfig);
240
241
  const hdAccount = mnemonicToAccount(MNEMONIC, {
241
242
  addressIndex: 0
242
243
  });
243
244
  const publisherPrivKeyRaw = hdAccount.getHdKey().privateKey;
244
245
  const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
246
+ const publisherPrivKeyHex = `0x${publisherPrivKey.toString('hex')}`;
245
247
  const l1Client = createExtendedL1Client([
246
248
  aztecNodeConfig.l1RpcUrls[0]
247
249
  ], hdAccount, foundry);
248
250
  const validatorPrivKey = getPrivateKeyFromIndex(0);
249
251
  const proverNodePrivateKey = getPrivateKeyFromIndex(0);
250
252
  aztecNodeConfig.publisherPrivateKeys = [
251
- new SecretValue(`0x${publisherPrivKey.toString('hex')}`)
253
+ new SecretValue(publisherPrivKeyHex)
252
254
  ];
253
255
  aztecNodeConfig.validatorPrivateKeys = new SecretValue([
254
256
  `0x${validatorPrivKey.toString('hex')}`
@@ -267,7 +269,7 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
267
269
  const dateProvider = new TestDateProvider();
268
270
  const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider);
269
271
  // Deploy our L1 contracts.
270
- logger.verbose('Deploying L1 contracts...');
272
+ logger.verbose('Deploying Aztec L1 contracts...');
271
273
  if (opts.l1StartTime) {
272
274
  await ethCheatCodes.warp(opts.l1StartTime, {
273
275
  resetBlockInterval: true
@@ -276,15 +278,20 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
276
278
  const initialFundedAccounts = await generateSchnorrAccounts(numberOfInitialFundedAccounts);
277
279
  const sponsoredFPCAddress = await getSponsoredFPCAddress();
278
280
  const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(initialFundedAccounts.map((a)=>a.address).concat(sponsoredFPCAddress), opts.initialAccountFeeJuice);
281
+ const vkTreeRoot = getVKTreeRoot();
279
282
  await deployMulticall3(l1Client, logger);
280
- const deployL1ContractsValues = await setupL1Contracts(aztecNodeConfig.l1RpcUrls[0], hdAccount, logger, {
283
+ // Define args, defaulted to our environment variables.
284
+ const args = {
281
285
  ...getL1ContractsConfigEnvVars(),
286
+ ...deployL1ContractsArgs,
287
+ vkTreeRoot,
282
288
  genesisArchiveRoot,
289
+ protocolContractsHash,
290
+ initialValidators: opts.initialValidators,
283
291
  feeJuicePortalInitialBalance: fundingNeeded,
284
- salt: opts.salt,
285
- ...deployL1ContractsArgs,
286
- initialValidators: opts.initialValidators
287
- });
292
+ realVerifier: false
293
+ };
294
+ const deployL1ContractsValues = await deployAztecL1Contracts(aztecNodeConfig.l1RpcUrls[0], publisherPrivKeyHex, foundry.id, args);
288
295
  aztecNodeConfig.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
289
296
  aztecNodeConfig.rollupVersion = deployL1ContractsValues.rollupVersion;
290
297
  const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider);
@@ -299,21 +306,13 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
299
306
  aztecNodeConfig.bbBinaryPath = bbConfig.bbBinaryPath;
300
307
  aztecNodeConfig.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
301
308
  }
302
- const telemetry = getEndToEndTestTelemetryClient(opts.metricsPort);
303
- // Setup blob sink service
304
- const blobSink = await createBlobSinkServer({
305
- l1ChainId: aztecNodeConfig.l1ChainId,
306
- l1RpcUrls: aztecNodeConfig.l1RpcUrls,
307
- l1Contracts: aztecNodeConfig.l1Contracts,
308
- port: blobSinkPort,
309
- dataDirectory: aztecNodeConfig.dataDirectory,
310
- dataStoreMapSizeKb: aztecNodeConfig.dataStoreMapSizeKb
311
- }, telemetry);
312
- await blobSink.start();
309
+ const telemetry = await getEndToEndTestTelemetryClient(opts.metricsPort);
310
+ const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('node:blob-client:client'));
313
311
  logger.info('Creating and synching an aztec node...');
314
312
  const aztecNode = await AztecNodeService.createAndSync(aztecNodeConfig, {
315
313
  telemetry,
316
- dateProvider
314
+ dateProvider,
315
+ blobClient
317
316
  }, {
318
317
  prefilledPublicData
319
318
  });
@@ -350,7 +349,6 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
350
349
  watcher,
351
350
  cheatCodes,
352
351
  dateProvider,
353
- blobSink,
354
352
  initialFundedAccounts,
355
353
  directoryToCleanup
356
354
  };
@@ -363,13 +361,11 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
363
361
  await fs.mkdir(directoryToCleanup, {
364
362
  recursive: true
365
363
  });
366
- // Run the blob sink on a random port
367
- const blobSinkPort = await getPort();
368
364
  // TODO: For some reason this is currently the union of a bunch of subsystems. That needs fixing.
369
365
  const aztecNodeConfig = JSON.parse(readFileSync(`${statePath}/aztec_node_config.json`, 'utf-8'), reviver);
370
366
  aztecNodeConfig.dataDirectory = statePath;
371
- aztecNodeConfig.blobSinkUrl = `http://127.0.0.1:${blobSinkPort}`;
372
367
  aztecNodeConfig.listenAddress = '127.0.0.1';
368
+ await setupSharedBlobStorage(aztecNodeConfig);
373
369
  const initialFundedAccounts = JSON.parse(readFileSync(`${statePath}/accounts.json`, 'utf-8'), reviver) || [];
374
370
  const { prefilledPublicData } = await getGenesisValues(initialFundedAccounts.map((a)=>a.address));
375
371
  // Start anvil. We go via a wrapper script to ensure if the parent dies, anvil dies.
@@ -397,20 +393,13 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
397
393
  const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, mnemonicToAccount(MNEMONIC));
398
394
  const watcher = new AnvilTestWatcher(ethCheatCodes, aztecNodeConfig.l1Contracts.rollupAddress, l1Client, dateProvider);
399
395
  await watcher.start();
400
- const telemetry = initTelemetryClient(getTelemetryConfig());
401
- const blobSink = await createBlobSinkServer({
402
- l1ChainId: aztecNodeConfig.l1ChainId,
403
- l1RpcUrls: aztecNodeConfig.l1RpcUrls,
404
- l1Contracts: aztecNodeConfig.l1Contracts,
405
- port: blobSinkPort,
406
- dataDirectory: statePath,
407
- dataStoreMapSizeKb: aztecNodeConfig.dataStoreMapSizeKb
408
- }, telemetry);
409
- await blobSink.start();
396
+ const telemetry = await initTelemetryClient(getTelemetryConfig());
397
+ const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('node:blob-client:client'));
410
398
  logger.verbose('Creating aztec node...');
411
399
  const aztecNode = await AztecNodeService.createAndSync(aztecNodeConfig, {
412
400
  telemetry,
413
- dateProvider
401
+ dateProvider,
402
+ blobClient
414
403
  }, {
415
404
  prefilledPublicData
416
405
  });
@@ -447,7 +436,6 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
447
436
  watcher,
448
437
  cheatCodes,
449
438
  dateProvider,
450
- blobSink,
451
439
  initialFundedAccounts,
452
440
  directoryToCleanup
453
441
  };