@aztec/end-to-end 0.0.1-commit.03f7ef2 → 0.0.1-commit.1142ef1

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 (69) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.js +1 -1
  2. package/dest/bench/client_flows/data_extractor.js +3 -1
  3. package/dest/bench/utils.d.ts +5 -5
  4. package/dest/bench/utils.d.ts.map +1 -1
  5. package/dest/bench/utils.js +18 -11
  6. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -4
  7. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  8. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +34 -18
  9. package/dest/e2e_epochs/epochs_test.js +1 -1
  10. package/dest/e2e_fees/fees_test.d.ts +1 -1
  11. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  12. package/dest/e2e_fees/fees_test.js +3 -3
  13. package/dest/e2e_l1_publisher/write_json.d.ts +1 -1
  14. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  15. package/dest/e2e_l1_publisher/write_json.js +2 -5
  16. package/dest/e2e_p2p/p2p_network.js +1 -1
  17. package/dest/e2e_p2p/shared.d.ts +1 -1
  18. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  19. package/dest/e2e_p2p/shared.js +4 -4
  20. package/dest/fixtures/e2e_prover_test.d.ts +1 -1
  21. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  22. package/dest/fixtures/e2e_prover_test.js +1 -2
  23. package/dest/fixtures/fixtures.d.ts +2 -2
  24. package/dest/fixtures/fixtures.d.ts.map +1 -1
  25. package/dest/fixtures/fixtures.js +1 -1
  26. package/dest/fixtures/snapshot_manager.d.ts +1 -1
  27. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  28. package/dest/fixtures/snapshot_manager.js +4 -9
  29. package/dest/fixtures/utils.d.ts +1 -4
  30. package/dest/fixtures/utils.d.ts.map +1 -1
  31. package/dest/fixtures/utils.js +1 -5
  32. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  33. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  34. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  35. package/dest/shared/cross_chain_test_harness.d.ts +3 -3
  36. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  37. package/dest/shared/cross_chain_test_harness.js +2 -2
  38. package/dest/shared/index.d.ts +2 -2
  39. package/dest/shared/index.d.ts.map +1 -1
  40. package/dest/shared/uniswap_l1_l2.d.ts +3 -28
  41. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  42. package/dest/shared/uniswap_l1_l2.js +39 -21
  43. package/dest/spartan/setup_test_wallets.d.ts +4 -3
  44. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  45. package/dest/spartan/utils.d.ts +24 -2
  46. package/dest/spartan/utils.d.ts.map +1 -1
  47. package/dest/spartan/utils.js +42 -3
  48. package/package.json +38 -38
  49. package/src/bench/client_flows/client_flows_benchmark.ts +1 -1
  50. package/src/bench/client_flows/data_extractor.ts +1 -1
  51. package/src/bench/utils.ts +22 -14
  52. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +40 -22
  53. package/src/e2e_epochs/epochs_test.ts +1 -1
  54. package/src/e2e_fees/fees_test.ts +3 -5
  55. package/src/e2e_l1_publisher/write_json.ts +2 -5
  56. package/src/e2e_p2p/p2p_network.ts +1 -1
  57. package/src/e2e_p2p/shared.ts +6 -5
  58. package/src/fixtures/e2e_prover_test.ts +0 -1
  59. package/src/fixtures/fixtures.ts +1 -1
  60. package/src/fixtures/snapshot_manager.ts +4 -9
  61. package/src/fixtures/utils.ts +2 -8
  62. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
  63. package/src/shared/cross_chain_test_harness.ts +3 -9
  64. package/src/shared/index.ts +1 -1
  65. package/src/shared/uniswap_l1_l2.ts +46 -58
  66. package/src/spartan/setup_test_wallets.ts +7 -1
  67. package/src/spartan/utils.ts +83 -2
  68. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  69. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
@@ -13,6 +13,7 @@ import type {
13
13
  } from '@aztec/ethereum/contracts';
14
14
  import { EpochNumber } from '@aztec/foundation/branded-types';
15
15
  import { timesAsync, unique } from '@aztec/foundation/collection';
16
+ import { EthAddress } from '@aztec/foundation/eth-address';
16
17
  import { retryUntil } from '@aztec/foundation/retry';
17
18
  import { pluralize } from '@aztec/foundation/string';
18
19
  import type { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
@@ -137,7 +138,7 @@ export async function awaitCommitteeExists({
137
138
  logger: Logger;
138
139
  }): Promise<readonly `0x${string}`[]> {
139
140
  logger.info(`Waiting for committee to be set`);
140
- let committee: readonly `0x${string}`[] | undefined;
141
+ let committee: EthAddress[] | undefined;
141
142
  await retryUntil(
142
143
  async () => {
143
144
  committee = await rollup.getCurrentEpochCommittee();
@@ -146,7 +147,7 @@ export async function awaitCommitteeExists({
146
147
  'non-empty committee',
147
148
  60,
148
149
  );
149
- return committee!;
150
+ return committee!.map(c => c.toString() as `0x${string}`);
150
151
  }
151
152
 
152
153
  export async function awaitOffenseDetected({
@@ -218,9 +219,9 @@ export async function awaitCommitteeKicked({
218
219
 
219
220
  if (slashingProposer.type === 'empire') {
220
221
  // Await for the slash payload to be created if empire (no payload is created on tally until execution time)
221
- const targetEpoch = BigInt(await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1n;
222
+ const targetEpoch = EpochNumber((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1);
222
223
  logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
223
- await cheatCodes.advanceToEpoch(EpochNumber.fromBigInt(targetEpoch));
224
+ await cheatCodes.advanceToEpoch(targetEpoch);
224
225
 
225
226
  const slashPayloadEvents = await retryUntil(
226
227
  async () => {
@@ -275,7 +276,7 @@ export async function awaitCommitteeKicked({
275
276
  logger.info(`Advancing to check current committee`);
276
277
  await cheatCodes.debugRollup();
277
278
  await cheatCodes.advanceToEpoch(
278
- EpochNumber.fromBigInt(BigInt(await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1n),
279
+ EpochNumber((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1),
279
280
  );
280
281
  await cheatCodes.debugRollup();
281
282
 
@@ -281,7 +281,6 @@ export class FullProverTest {
281
281
  {
282
282
  aztecNodeTxProvider: this.aztecNode,
283
283
  archiver: archiver as Archiver,
284
- blobClient,
285
284
  },
286
285
  { prefilledPublicData },
287
286
  );
@@ -8,7 +8,7 @@ export const shouldCollectMetrics = () => {
8
8
  };
9
9
 
10
10
  export const TEST_PEER_CHECK_INTERVAL_MS = 1000;
11
- export const TEST_MAX_TX_POOL_SIZE = 2 * 1024 * 1024 * 1024; // 2GB
11
+ export const TEST_MAX_PENDING_TX_POOL_COUNT = 10_000; // Number of max pending TXs ~ 1.56GB
12
12
 
13
13
  export const MNEMONIC = 'test test test test test test test test test test test junk';
14
14
  export const privateKey = Buffer.from('ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', 'hex');
@@ -9,7 +9,6 @@ import type { Logger } from '@aztec/aztec.js/log';
9
9
  import type { AztecNode } from '@aztec/aztec.js/node';
10
10
  import type { Wallet } from '@aztec/aztec.js/wallet';
11
11
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
12
- import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
13
12
  import { createExtendedL1Client } from '@aztec/ethereum/client';
14
13
  import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
15
14
  import { deployMulticall3 } from '@aztec/ethereum/contracts';
@@ -46,7 +45,7 @@ import type { Hex } from 'viem';
46
45
  import { mnemonicToAccount } from 'viem/accounts';
47
46
  import { foundry } from 'viem/chains';
48
47
 
49
- import { MNEMONIC, TEST_MAX_TX_POOL_SIZE, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
48
+ import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
50
49
  import { getACVMConfig } from './get_acvm_config.js';
51
50
  import { getBBConfig } from './get_bb_config.js';
52
51
  import {
@@ -303,7 +302,7 @@ async function setupFromFresh(
303
302
  // TODO: For some reason this is currently the union of a bunch of subsystems. That needs fixing.
304
303
  const aztecNodeConfig: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
305
304
  aztecNodeConfig.peerCheckIntervalMS = TEST_PEER_CHECK_INTERVAL_MS;
306
- aztecNodeConfig.maxTxPoolSize = opts.maxTxPoolSize ?? TEST_MAX_TX_POOL_SIZE;
305
+ aztecNodeConfig.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
307
306
  // Only enable proving if specifically requested.
308
307
  aztecNodeConfig.realProofs = !!opts.realProofs;
309
308
  // Only enforce the time table if requested
@@ -410,12 +409,10 @@ async function setupFromFresh(
410
409
 
411
410
  const telemetry = await getEndToEndTestTelemetryClient(opts.metricsPort);
412
411
 
413
- const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('node:blob-client:client'));
414
-
415
412
  logger.info('Creating and synching an aztec node...');
416
413
  const aztecNode = await AztecNodeService.createAndSync(
417
414
  aztecNodeConfig,
418
- { telemetry, dateProvider, blobClient },
415
+ { telemetry, dateProvider },
419
416
  { prefilledPublicData },
420
417
  );
421
418
 
@@ -525,12 +522,10 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
525
522
 
526
523
  const telemetry = await initTelemetryClient(getTelemetryConfig());
527
524
 
528
- const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('node:blob-client:client'));
529
-
530
525
  logger.verbose('Creating aztec node...');
531
526
  const aztecNode = await AztecNodeService.createAndSync(
532
527
  aztecNodeConfig,
533
- { telemetry, dateProvider, blobClient },
528
+ { telemetry, dateProvider },
534
529
  { prefilledPublicData },
535
530
  );
536
531
 
@@ -10,7 +10,7 @@ import { type Logger, createLogger } from '@aztec/aztec.js/log';
10
10
  import { type AztecNode, createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
11
11
  import type { Wallet } from '@aztec/aztec.js/wallet';
12
12
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
13
- import { type BlobClientInterface, createBlobClientWithFileStores } from '@aztec/blob-client/client';
13
+ import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
14
14
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
15
15
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
16
16
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -241,7 +241,6 @@ async function setupWithRemoteEnvironment(
241
241
  watcher: undefined,
242
242
  dateProvider: undefined,
243
243
  telemetryClient: undefined,
244
- blobClient: undefined,
245
244
  teardown,
246
245
  };
247
246
  }
@@ -326,8 +325,6 @@ export type EndToEndContext = {
326
325
  mockGossipSubNetwork: MockGossipSubNetwork | undefined;
327
326
  /** Prefilled public data used for setting up nodes. */
328
327
  prefilledPublicData: PublicDataTreeLeaf[] | undefined;
329
- /** The blob client client used for blob storage (undefined if connected to remote environment) */
330
- blobClient: BlobClientInterface | undefined;
331
328
  /** Function to stop the started services. */
332
329
  teardown: () => Promise<void>;
333
330
  };
@@ -513,8 +510,6 @@ export async function setup(
513
510
  config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
514
511
  }
515
512
 
516
- const blobClient = await createBlobClientWithFileStores(config, createLogger('node:blob-client:client'));
517
-
518
513
  let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
519
514
  let p2pClientDeps: P2PClientDeps<P2PClientType.Full> | undefined = undefined;
520
515
 
@@ -553,7 +548,7 @@ export async function setup(
553
548
 
554
549
  const aztecNode = await AztecNodeService.createAndSync(
555
550
  config, // REFACTOR: createAndSync mutates this config
556
- { dateProvider, blobClient, telemetry, p2pClientDeps, logger: createLogger('node:MAIN-aztec-node') },
551
+ { dateProvider, telemetry, p2pClientDeps, logger: createLogger('node:MAIN-aztec-node') },
557
552
  { prefilledPublicData },
558
553
  );
559
554
  const sequencerClient = aztecNode.getSequencer();
@@ -666,7 +661,6 @@ export async function setup(
666
661
  wallet,
667
662
  accounts,
668
663
  watcher,
669
- blobClient,
670
664
  };
671
665
  } catch (err) {
672
666
  // TODO: Just hoisted anvil for now to ensure cleanup. Prob need to hoist the rest.
@@ -25,7 +25,7 @@ const DEFAULT_CONFIG: AlertCheckerConfig = {
25
25
  grafanaCredentials: 'admin:admin',
26
26
  };
27
27
 
28
- export class AlertChecker {
28
+ export class GrafanaClient {
29
29
  private config: AlertCheckerConfig;
30
30
  private logger: Logger;
31
31
 
@@ -16,7 +16,7 @@ import type { Wallet } from '@aztec/aztec.js/wallet';
16
16
  import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
17
17
  import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
18
18
  import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
19
- import { BlockNumber } from '@aztec/foundation/branded-types';
19
+ import { EpochNumber } from '@aztec/foundation/branded-types';
20
20
  import { retryUntil } from '@aztec/foundation/retry';
21
21
  import type { FieldsOf } from '@aztec/foundation/types';
22
22
  import { TestERC20Abi, TokenPortalAbi, TokenPortalBytecode } from '@aztec/l1-artifacts';
@@ -324,17 +324,11 @@ export class CrossChainTestHarness {
324
324
 
325
325
  withdrawFundsFromBridgeOnL1(
326
326
  amount: bigint,
327
- blockNumber: BlockNumber,
327
+ epochNumber: EpochNumber,
328
328
  messageIndex: bigint,
329
329
  siblingPath: SiblingPath<number>,
330
330
  ) {
331
- return this.l1TokenPortalManager.withdrawFunds(
332
- amount,
333
- this.ethAccount,
334
- BigInt(blockNumber),
335
- messageIndex,
336
- siblingPath,
337
- );
331
+ return this.l1TokenPortalManager.withdrawFunds(amount, this.ethAccount, epochNumber, messageIndex, siblingPath);
338
332
  }
339
333
 
340
334
  async transferToPrivateOnL2(shieldAmount: bigint) {
@@ -1 +1 @@
1
- export { uniswapL1L2TestSuite, type UniswapSetupContext } from './uniswap_l1_l2.js';
1
+ export { uniswapL1L2TestSuite } from './uniswap_l1_l2.js';
@@ -1,5 +1,6 @@
1
1
  import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
2
2
  import { computeAuthWitMessageHash } from '@aztec/aztec.js/authorization';
3
+ import { waitForProven } from '@aztec/aztec.js/contracts';
3
4
  import { generateClaimSecret } from '@aztec/aztec.js/ethereum';
4
5
  import { Fr } from '@aztec/aztec.js/fields';
5
6
  import type { Logger } from '@aztec/aztec.js/log';
@@ -10,6 +11,7 @@ import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-az
10
11
  import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
11
12
  import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
12
13
  import { extractEvent } from '@aztec/ethereum/utils';
14
+ import { CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
13
15
  import { sha256ToField } from '@aztec/foundation/crypto/sha256';
14
16
  import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
15
17
  import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
@@ -20,7 +22,7 @@ import type { TestWallet } from '@aztec/test-wallet/server';
20
22
  import { jest } from '@jest/globals';
21
23
  import { type GetContractReturnType, getContract, parseEther, toFunctionSelector } from 'viem';
22
24
 
23
- import { ensureAccountContractsPublished } from '../fixtures/utils.js';
25
+ import { type EndToEndContext, ensureAccountContractsPublished } from '../fixtures/utils.js';
24
26
  import { CrossChainTestHarness } from './cross_chain_test_harness.js';
25
27
 
26
28
  // PSA: This tests works on forked mainnet. There is a dump of the data in `dumpedState` such that we
@@ -32,28 +34,8 @@ import { CrossChainTestHarness } from './cross_chain_test_harness.js';
32
34
 
33
35
  const TIMEOUT = 360_000;
34
36
 
35
- /** Objects to be returned by the uniswap setup function */
36
- export type UniswapSetupContext = {
37
- /** Aztec Node instance */
38
- aztecNode: AztecNode;
39
- /** Logger instance named as the current test. */
40
- logger: Logger;
41
- /** The L1 wallet client, extended with public actions. */
42
- l1Client: ExtendedViemWalletClient;
43
- /** The wallet. */
44
- wallet: TestWallet;
45
- /** The owner address. */
46
- ownerAddress: AztecAddress;
47
- /** The sponsor wallet. */
48
- sponsorAddress: AztecAddress;
49
- /** */
50
- deployL1ContractsValues: DeployAztecL1ContractsReturnType;
51
- /** Cheat codes instance. */
52
- cheatCodes: CheatCodes;
53
- };
54
-
55
37
  export const uniswapL1L2TestSuite = (
56
- setup: () => Promise<UniswapSetupContext>,
38
+ setup: () => Promise<EndToEndContext>,
57
39
  cleanup: () => Promise<void>,
58
40
  expectedForkBlockNumber = 17514288,
59
41
  ) => {
@@ -90,8 +72,19 @@ export const uniswapL1L2TestSuite = (
90
72
  let cheatCodes: CheatCodes;
91
73
  let version: number;
92
74
  beforeAll(async () => {
93
- ({ aztecNode, logger, l1Client, wallet, ownerAddress, sponsorAddress, deployL1ContractsValues, cheatCodes } =
94
- await setup());
75
+ const t = await setup();
76
+ ({
77
+ aztecNode,
78
+ logger,
79
+ deployL1ContractsValues,
80
+ cheatCodes,
81
+ wallet,
82
+ accounts: [ownerAddress, sponsorAddress],
83
+ } = t);
84
+
85
+ l1Client = deployL1ContractsValues.l1Client;
86
+
87
+ t.watcher?.setIsMarkingAsProven(false);
95
88
 
96
89
  if (Number(await l1Client.getBlockNumber()) < expectedForkBlockNumber) {
97
90
  throw new Error('This test must be run on a fork of mainnet with the expected fork block');
@@ -259,24 +252,19 @@ export const uniswapL1L2TestSuite = (
259
252
  // ensure that uniswap contract didn't eat the funds.
260
253
  await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
261
254
 
262
- // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
263
- await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
255
+ // Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
256
+ const checkpointNumber = CheckpointNumber.fromBlockNumber(l2UniswapInteractionReceipt.blockNumber!);
257
+ const epoch = await rollup.getEpochNumberForCheckpoint(checkpointNumber);
258
+ await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
259
+ await waitForProven(aztecNode, l2UniswapInteractionReceipt, { provenTimeout: 300 });
264
260
 
265
261
  // 5. Consume L2 to L1 message by calling uniswapPortal.swap_private()
266
262
  logger.info('Execute withdraw and swap on the uniswapPortal!');
267
263
  const daiL1BalanceOfPortalBeforeSwap = await daiCrossChainHarness.getL1BalanceOf(
268
264
  daiCrossChainHarness.tokenPortalAddress,
269
265
  );
270
- const swapResult = await computeL2ToL1MembershipWitness(
271
- aztecNode,
272
- l2UniswapInteractionReceipt.blockNumber!,
273
- swapPrivateLeaf,
274
- );
275
- const withdrawResult = await computeL2ToL1MembershipWitness(
276
- aztecNode,
277
- l2UniswapInteractionReceipt.blockNumber!,
278
- withdrawLeaf,
279
- );
266
+ const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPrivateLeaf);
267
+ const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
280
268
 
281
269
  const swapPrivateL2MessageIndex = swapResult!.leafIndex;
282
270
  const swapPrivateSiblingPath = swapResult!.siblingPath;
@@ -285,7 +273,7 @@ export const uniswapL1L2TestSuite = (
285
273
  const withdrawSiblingPath = withdrawResult!.siblingPath;
286
274
 
287
275
  const withdrawMessageMetadata = {
288
- _checkpointNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
276
+ _epoch: BigInt(epoch),
289
277
  _leafIndex: BigInt(withdrawL2MessageIndex),
290
278
  _path: withdrawSiblingPath
291
279
  .toBufferArray()
@@ -293,7 +281,7 @@ export const uniswapL1L2TestSuite = (
293
281
  };
294
282
 
295
283
  const swapPrivateMessageMetadata = {
296
- _checkpointNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
284
+ _epoch: BigInt(epoch),
297
285
  _leafIndex: BigInt(swapPrivateL2MessageIndex),
298
286
  _path: swapPrivateSiblingPath
299
287
  .toBufferArray()
@@ -504,7 +492,7 @@ export const uniswapL1L2TestSuite = (
504
492
  // );
505
493
 
506
494
  // const withdrawMessageMetadata = {
507
- // _checkpointNumber: BigInt(uniswapL2Interaction.blockNumber!),
495
+ // _epoch: epoch,
508
496
  // _leafIndex: BigInt(withdrawL2MessageIndex),
509
497
  // _path: withdrawSiblingPath
510
498
  // .toBufferArray()
@@ -512,7 +500,7 @@ export const uniswapL1L2TestSuite = (
512
500
  // };
513
501
 
514
502
  // const swapPrivateMessageMetadata = {
515
- // _checkpointNumber: BigInt(uniswapL2Interaction.blockNumber!),
503
+ // _epoch: epoch,
516
504
  // _leafIndex: BigInt(swapPrivateL2MessageIndex),
517
505
  // _path: swapPrivateSiblingPath
518
506
  // .toBufferArray()
@@ -856,12 +844,11 @@ export const uniswapL1L2TestSuite = (
856
844
  chainId: new Fr(l1Client.chain.id),
857
845
  });
858
846
 
859
- const swapResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber!, swapPrivateLeaf);
860
- const withdrawResult = await computeL2ToL1MembershipWitness(
861
- aztecNode,
862
- withdrawReceipt.blockNumber!,
863
- withdrawLeaf,
847
+ const epoch = await rollup.getEpochNumberForCheckpoint(
848
+ CheckpointNumber.fromBlockNumber(withdrawReceipt.blockNumber!),
864
849
  );
850
+ const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPrivateLeaf);
851
+ const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
865
852
 
866
853
  const swapPrivateL2MessageIndex = swapResult!.leafIndex;
867
854
  const swapPrivateSiblingPath = swapResult!.siblingPath;
@@ -870,7 +857,7 @@ export const uniswapL1L2TestSuite = (
870
857
  const withdrawSiblingPath = withdrawResult!.siblingPath;
871
858
 
872
859
  const withdrawMessageMetadata = {
873
- _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
860
+ _epoch: BigInt(epoch),
874
861
  _leafIndex: BigInt(withdrawL2MessageIndex),
875
862
  _path: withdrawSiblingPath
876
863
  .toBufferArray()
@@ -878,7 +865,7 @@ export const uniswapL1L2TestSuite = (
878
865
  };
879
866
 
880
867
  const swapPrivateMessageMetadata = {
881
- _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
868
+ _epoch: BigInt(epoch),
882
869
  _leafIndex: BigInt(swapPrivateL2MessageIndex),
883
870
  _path: swapPrivateSiblingPath
884
871
  .toBufferArray()
@@ -888,8 +875,9 @@ export const uniswapL1L2TestSuite = (
888
875
  // ensure that user's funds were burnt
889
876
  await wethCrossChainHarness.expectPrivateBalanceOnL2(ownerAddress, wethL2BalanceBeforeSwap - wethAmountToBridge);
890
877
 
891
- // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
892
- await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
878
+ // Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
879
+ await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
880
+ await waitForProven(aztecNode, withdrawReceipt, { provenTimeout: 300 });
893
881
 
894
882
  // On L1 call swap_public!
895
883
  logger.info('call swap_public on L1');
@@ -991,12 +979,11 @@ export const uniswapL1L2TestSuite = (
991
979
  chainId: new Fr(l1Client.chain.id),
992
980
  });
993
981
 
994
- const swapResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber!, swapPublicLeaf);
995
- const withdrawResult = await computeL2ToL1MembershipWitness(
996
- aztecNode,
997
- withdrawReceipt.blockNumber!,
998
- withdrawLeaf,
982
+ const epoch = await rollup.getEpochNumberForCheckpoint(
983
+ CheckpointNumber.fromBlockNumber(withdrawReceipt.blockNumber!),
999
984
  );
985
+ const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPublicLeaf);
986
+ const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
1000
987
 
1001
988
  const swapPublicL2MessageIndex = swapResult!.leafIndex;
1002
989
  const swapPublicSiblingPath = swapResult!.siblingPath;
@@ -1005,7 +992,7 @@ export const uniswapL1L2TestSuite = (
1005
992
  const withdrawSiblingPath = withdrawResult!.siblingPath;
1006
993
 
1007
994
  const withdrawMessageMetadata = {
1008
- _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
995
+ _epoch: BigInt(epoch),
1009
996
  _leafIndex: BigInt(withdrawL2MessageIndex),
1010
997
  _path: withdrawSiblingPath
1011
998
  .toBufferArray()
@@ -1013,7 +1000,7 @@ export const uniswapL1L2TestSuite = (
1013
1000
  };
1014
1001
 
1015
1002
  const swapPublicMessageMetadata = {
1016
- _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
1003
+ _epoch: BigInt(epoch),
1017
1004
  _leafIndex: BigInt(swapPublicL2MessageIndex),
1018
1005
  _path: swapPublicSiblingPath
1019
1006
  .toBufferArray()
@@ -1023,8 +1010,9 @@ export const uniswapL1L2TestSuite = (
1023
1010
  // check weth balance of owner on L2 (we first bridged `wethAmountToBridge` into L2 and now withdrew it!)
1024
1011
  await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
1025
1012
 
1026
- // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
1027
- await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
1013
+ // Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
1014
+ await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
1015
+ await waitForProven(aztecNode, withdrawReceipt, { provenTimeout: 300 });
1028
1016
 
1029
1017
  // Call swap_private on L1
1030
1018
  logger.info('Execute withdraw and swap on the uniswapPortal!');
@@ -315,11 +315,17 @@ export async function performTransfers({
315
315
  }
316
316
  }
317
317
 
318
+ export type WalletWrapper = {
319
+ wallet: TestWallet;
320
+ aztecNode: AztecNode;
321
+ cleanup: () => Promise<void>;
322
+ };
323
+
318
324
  export async function createWalletAndAztecNodeClient(
319
325
  nodeUrl: string,
320
326
  proverEnabled: boolean,
321
327
  logger: Logger,
322
- ): Promise<{ wallet: TestWallet; aztecNode: AztecNode; cleanup: () => Promise<void> }> {
328
+ ): Promise<WalletWrapper> {
323
329
  const aztecNode = createAztecNodeClient(nodeUrl);
324
330
  const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
325
331
  const pxeConfig = {
@@ -246,7 +246,10 @@ export async function deleteResourceByLabel({
246
246
  force?: boolean;
247
247
  }) {
248
248
  try {
249
- await execAsync(`kubectl api-resources --no-headers -o name | grep -Eq "^${resource}(\\\\..+)?$"`);
249
+ // Match both plain and group-qualified names (e.g., "podchaos" or "podchaos.chaos-mesh.org")
250
+ const escaped = resource.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
251
+ const regex = `(^|\\.)${escaped}(\\.|$)`;
252
+ await execAsync(`kubectl api-resources --no-headers -o name | grep -Eq '${regex}'`);
250
253
  } catch (error) {
251
254
  logger.warn(`Resource type '${resource}' not found in cluster, skipping deletion ${error}`);
252
255
  return '';
@@ -279,6 +282,58 @@ export async function waitForResourceByLabel({
279
282
  return stdout;
280
283
  }
281
284
 
285
+ export async function waitForResourceByName({
286
+ resource,
287
+ name,
288
+ namespace,
289
+ condition = 'Ready',
290
+ timeout = '10m',
291
+ }: {
292
+ resource: string;
293
+ name: string;
294
+ namespace: string;
295
+ condition?: string;
296
+ timeout?: string;
297
+ }) {
298
+ const command = `kubectl wait ${resource}/${name} --for=condition=${condition} -n ${namespace} --timeout=${timeout}`;
299
+ logger.info(`command: ${command}`);
300
+ const { stdout } = await execAsync(command);
301
+ return stdout;
302
+ }
303
+
304
+ export async function waitForResourcesByName({
305
+ resource,
306
+ names,
307
+ namespace,
308
+ condition = 'Ready',
309
+ timeout = '10m',
310
+ }: {
311
+ resource: string;
312
+ names: string[];
313
+ namespace: string;
314
+ condition?: string;
315
+ timeout?: string;
316
+ }) {
317
+ if (!names.length) {
318
+ throw new Error(`No ${resource} names provided to waitForResourcesByName`);
319
+ }
320
+
321
+ // Wait all in parallel; if any fails, surface which one.
322
+ await Promise.all(
323
+ names.map(async name => {
324
+ try {
325
+ await waitForResourceByName({ resource, name, namespace, condition, timeout });
326
+ } catch (err) {
327
+ throw new Error(
328
+ `Failed waiting for ${resource}/${name} condition=${condition} timeout=${timeout} namespace=${namespace}: ${String(
329
+ err,
330
+ )}`,
331
+ );
332
+ }
333
+ }),
334
+ );
335
+ }
336
+
282
337
  export function getChartDir(spartanDir: string, chartName: string) {
283
338
  return path.join(spartanDir.trim(), chartName);
284
339
  }
@@ -458,6 +513,29 @@ export function applyProverFailure({
458
513
  });
459
514
  }
460
515
 
516
+ export function applyValidatorFailure({
517
+ namespace,
518
+ spartanDir,
519
+ logger,
520
+ values,
521
+ instanceName,
522
+ }: {
523
+ namespace: string;
524
+ spartanDir: string;
525
+ logger: Logger;
526
+ values?: Record<string, string | number>;
527
+ instanceName?: string;
528
+ }) {
529
+ return installChaosMeshChart({
530
+ instanceName: instanceName ?? 'validator-failure',
531
+ targetNamespace: namespace,
532
+ valuesFile: 'validator-failure.yaml',
533
+ helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
534
+ values,
535
+ logger,
536
+ });
537
+ }
538
+
461
539
  export function applyProverKill({
462
540
  namespace,
463
541
  spartanDir,
@@ -537,18 +615,21 @@ export function applyValidatorKill({
537
615
  spartanDir,
538
616
  logger,
539
617
  values,
618
+ clean = true,
540
619
  }: {
541
620
  instanceName?: string;
542
621
  namespace: string;
543
622
  spartanDir: string;
544
623
  logger: Logger;
545
624
  values?: Record<string, string | number>;
625
+ clean?: boolean;
546
626
  }) {
547
627
  return installChaosMeshChart({
548
- instanceName,
628
+ instanceName: instanceName ?? 'validator-kill',
549
629
  targetNamespace: namespace,
550
630
  valuesFile: 'validator-kill.yaml',
551
631
  helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
632
+ clean,
552
633
  logger,
553
634
  values,
554
635
  });
@@ -1,41 +0,0 @@
1
- import type { Logger } from '@aztec/aztec.js/log';
2
- export interface AlertConfig {
3
- alert: string;
4
- expr: string;
5
- start?: number;
6
- end?: number;
7
- step?: number;
8
- for: string;
9
- labels: Record<string, string>;
10
- annotations: Record<string, string>;
11
- }
12
- export interface AlertCheckerConfig {
13
- grafanaEndpoint: string;
14
- grafanaCredentials: string;
15
- }
16
- export declare class AlertChecker {
17
- private config;
18
- private logger;
19
- constructor(logger: Logger, config?: Partial<AlertCheckerConfig>);
20
- /**
21
- * Load the alerts config from a file path.
22
- * @param filePath - The absolute path to the alerts file.
23
- */
24
- private loadAlertsConfig;
25
- private queryGrafana;
26
- private checkAlerts;
27
- /**
28
- * Run the alert check based on the alerts defined in an array.
29
- * @param alerts - The alerts to check.
30
- */
31
- runAlertCheck(alerts: AlertConfig[]): Promise<void>;
32
- /**
33
- * Run the alert check based on the alerts defined in a yaml file.
34
- * @param filePath - The absolute path to the alerts file.
35
- */
36
- runAlertCheckFromFilePath(filePath: string): Promise<void>;
37
- }
38
- export declare class AlertTriggeredError extends Error {
39
- name: string;
40
- }
41
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWxlcnRfY2hlY2tlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3F1YWxpdHlfb2Zfc2VydmljZS9hbGVydF9jaGVja2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBS2xELE1BQU0sV0FBVyxXQUFXO0lBQzFCLEtBQUssRUFBRSxNQUFNLENBQUM7SUFDZCxJQUFJLEVBQUUsTUFBTSxDQUFDO0lBQ2IsS0FBSyxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ2YsR0FBRyxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ2IsSUFBSSxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ2QsR0FBRyxFQUFFLE1BQU0sQ0FBQztJQUNaLE1BQU0sRUFBRSxNQUFNLENBQUMsTUFBTSxFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBQy9CLFdBQVcsRUFBRSxNQUFNLENBQUMsTUFBTSxFQUFFLE1BQU0sQ0FBQyxDQUFDO0NBQ3JDO0FBRUQsTUFBTSxXQUFXLGtCQUFrQjtJQUNqQyxlQUFlLEVBQUUsTUFBTSxDQUFDO0lBQ3hCLGtCQUFrQixFQUFFLE1BQU0sQ0FBQztDQUM1QjtBQVFELHFCQUFhLFlBQVk7SUFDdkIsT0FBTyxDQUFDLE1BQU0sQ0FBcUI7SUFDbkMsT0FBTyxDQUFDLE1BQU0sQ0FBUztJQUV2QixZQUFZLE1BQU0sRUFBRSxNQUFNLEVBQUUsTUFBTSxHQUFFLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBTSxFQUduRTtJQUVEOzs7T0FHRztJQUNILE9BQU8sQ0FBQyxnQkFBZ0I7WUFNVixZQUFZO1lBcUNaLFdBQVc7SUFxQnpCOzs7T0FHRztJQUNVLGFBQWEsQ0FBQyxNQUFNLEVBQUUsV0FBVyxFQUFFLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQVEvRDtJQUVEOzs7T0FHRztJQUNVLHlCQUF5QixDQUFDLFFBQVEsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUd0RTtDQUNGO0FBRUQscUJBQWEsbUJBQW9CLFNBQVEsS0FBSztJQUNuQyxJQUFJLFNBQXlCO0NBQ3ZDIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"alert_checker.d.ts","sourceRoot":"","sources":["../../src/quality_of_service/alert_checker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAKlD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAQD,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,MAAM,CAAS;IAEvB,YAAY,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,CAAC,kBAAkB,CAAM,EAGnE;IAED;;;OAGG;IACH,OAAO,CAAC,gBAAgB;YAMV,YAAY;YAqCZ,WAAW;IAqBzB;;;OAGG;IACU,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ/D;IAED;;;OAGG;IACU,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGtE;CACF;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IACnC,IAAI,SAAyB;CACvC"}