@aztec/end-to-end 3.0.0-nightly.20251127 → 3.0.0-nightly.20251201.2

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 (89) 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 +1 -1
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  5. package/dest/bench/client_flows/config.d.ts +1 -1
  6. package/dest/bench/client_flows/data_extractor.d.ts +1 -1
  7. package/dest/bench/utils.d.ts +2 -2
  8. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
  9. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  10. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +1 -1
  11. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  12. package/dest/e2e_deploy_contract/deploy_test.d.ts +1 -1
  13. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  14. package/dest/e2e_epochs/epochs_test.d.ts +1 -1
  15. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  16. package/dest/e2e_epochs/epochs_test.js +3 -2
  17. package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
  18. package/dest/e2e_fees/fees_test.d.ts +1 -1
  19. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  20. package/dest/e2e_l1_publisher/write_json.d.ts +1 -1
  21. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  22. package/dest/e2e_l1_publisher/write_json.js +2 -2
  23. package/dest/e2e_multi_validator/utils.d.ts +1 -1
  24. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  25. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  26. package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
  27. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  28. package/dest/e2e_p2p/inactivity_slash_test.js +6 -2
  29. package/dest/e2e_p2p/p2p_network.d.ts +214 -9
  30. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  31. package/dest/e2e_p2p/p2p_network.js +2 -1
  32. package/dest/e2e_p2p/shared.d.ts +5 -5
  33. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  34. package/dest/e2e_p2p/shared.js +5 -4
  35. package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
  36. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  37. package/dest/fixtures/e2e_prover_test.d.ts +1 -1
  38. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  39. package/dest/fixtures/fixtures.d.ts +1 -1
  40. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  41. package/dest/fixtures/get_bb_config.d.ts +1 -1
  42. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  43. package/dest/fixtures/index.d.ts +1 -1
  44. package/dest/fixtures/l1_to_l2_messaging.d.ts +1 -1
  45. package/dest/fixtures/logging.d.ts +1 -1
  46. package/dest/fixtures/setup_l1_contracts.d.ts +475 -4
  47. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  48. package/dest/fixtures/setup_p2p_test.d.ts +1 -1
  49. package/dest/fixtures/snapshot_manager.d.ts +2 -2
  50. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  51. package/dest/fixtures/token_utils.d.ts +1 -1
  52. package/dest/fixtures/utils.d.ts +449 -4
  53. package/dest/fixtures/utils.d.ts.map +1 -1
  54. package/dest/fixtures/utils.js +2 -1
  55. package/dest/fixtures/web3signer.d.ts +1 -1
  56. package/dest/fixtures/with_telemetry_utils.d.ts +1 -1
  57. package/dest/index.d.ts +1 -1
  58. package/dest/quality_of_service/alert_checker.d.ts +1 -1
  59. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  60. package/dest/shared/cross_chain_test_harness.d.ts +1 -12
  61. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  62. package/dest/shared/gas_portal_test_harness.d.ts +1 -11
  63. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  64. package/dest/shared/index.d.ts +1 -1
  65. package/dest/shared/jest_setup.d.ts +1 -1
  66. package/dest/shared/submit-transactions.d.ts +1 -1
  67. package/dest/shared/submit-transactions.d.ts.map +1 -1
  68. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  69. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  70. package/dest/simulators/index.d.ts +1 -1
  71. package/dest/simulators/lending_simulator.d.ts +1 -5
  72. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  73. package/dest/simulators/lending_simulator.js +3 -1
  74. package/dest/simulators/token_simulator.d.ts +1 -1
  75. package/dest/simulators/token_simulator.d.ts.map +1 -1
  76. package/dest/spartan/setup_test_wallets.d.ts +2 -2
  77. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  78. package/dest/spartan/utils.d.ts +19 -17
  79. package/dest/spartan/utils.d.ts.map +1 -1
  80. package/dest/spartan/utils.js +57 -24
  81. package/package.json +41 -40
  82. package/src/e2e_epochs/epochs_test.ts +3 -2
  83. package/src/e2e_l1_publisher/write_json.ts +2 -2
  84. package/src/e2e_p2p/inactivity_slash_test.ts +6 -2
  85. package/src/e2e_p2p/p2p_network.ts +4 -1
  86. package/src/e2e_p2p/shared.ts +7 -4
  87. package/src/fixtures/utils.ts +4 -1
  88. package/src/simulators/lending_simulator.ts +3 -1
  89. package/src/spartan/utils.ts +62 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/end-to-end",
3
- "version": "3.0.0-nightly.20251127",
3
+ "version": "3.0.0-nightly.20251201.2",
4
4
  "type": "module",
5
5
  "exports": "./dest/index.js",
6
6
  "inherits": [
@@ -8,8 +8,8 @@
8
8
  "./package.local.json"
9
9
  ],
10
10
  "scripts": {
11
- "build": "yarn clean && tsc -b",
12
- "build:dev": "tsc -b --watch",
11
+ "build": "yarn clean && tsgo -b",
12
+ "build:dev": "tsgo -b --watch",
13
13
  "clean": "rm -rf ./dest .tsbuildinfo",
14
14
  "test:with-alerts": "./scripts/test-with-alerts.sh",
15
15
  "test:e2e": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit",
@@ -25,43 +25,43 @@
25
25
  "formatting": "run -T prettier --check ./src && run -T eslint ./src"
26
26
  },
27
27
  "dependencies": {
28
- "@aztec/accounts": "3.0.0-nightly.20251127",
29
- "@aztec/archiver": "3.0.0-nightly.20251127",
30
- "@aztec/aztec": "3.0.0-nightly.20251127",
31
- "@aztec/aztec-node": "3.0.0-nightly.20251127",
32
- "@aztec/aztec.js": "3.0.0-nightly.20251127",
33
- "@aztec/bb-prover": "3.0.0-nightly.20251127",
34
- "@aztec/bb.js": "3.0.0-nightly.20251127",
35
- "@aztec/blob-lib": "3.0.0-nightly.20251127",
36
- "@aztec/blob-sink": "3.0.0-nightly.20251127",
37
- "@aztec/bot": "3.0.0-nightly.20251127",
38
- "@aztec/cli": "3.0.0-nightly.20251127",
39
- "@aztec/constants": "3.0.0-nightly.20251127",
40
- "@aztec/entrypoints": "3.0.0-nightly.20251127",
41
- "@aztec/epoch-cache": "3.0.0-nightly.20251127",
42
- "@aztec/ethereum": "3.0.0-nightly.20251127",
43
- "@aztec/foundation": "3.0.0-nightly.20251127",
44
- "@aztec/kv-store": "3.0.0-nightly.20251127",
45
- "@aztec/l1-artifacts": "3.0.0-nightly.20251127",
46
- "@aztec/merkle-tree": "3.0.0-nightly.20251127",
47
- "@aztec/node-keystore": "3.0.0-nightly.20251127",
48
- "@aztec/noir-contracts.js": "3.0.0-nightly.20251127",
49
- "@aztec/noir-noirc_abi": "3.0.0-nightly.20251127",
50
- "@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251127",
51
- "@aztec/noir-test-contracts.js": "3.0.0-nightly.20251127",
52
- "@aztec/p2p": "3.0.0-nightly.20251127",
53
- "@aztec/protocol-contracts": "3.0.0-nightly.20251127",
54
- "@aztec/prover-client": "3.0.0-nightly.20251127",
55
- "@aztec/prover-node": "3.0.0-nightly.20251127",
56
- "@aztec/pxe": "3.0.0-nightly.20251127",
57
- "@aztec/sequencer-client": "3.0.0-nightly.20251127",
58
- "@aztec/simulator": "3.0.0-nightly.20251127",
59
- "@aztec/slasher": "3.0.0-nightly.20251127",
60
- "@aztec/stdlib": "3.0.0-nightly.20251127",
61
- "@aztec/telemetry-client": "3.0.0-nightly.20251127",
62
- "@aztec/test-wallet": "3.0.0-nightly.20251127",
63
- "@aztec/validator-client": "3.0.0-nightly.20251127",
64
- "@aztec/world-state": "3.0.0-nightly.20251127",
28
+ "@aztec/accounts": "3.0.0-nightly.20251201.2",
29
+ "@aztec/archiver": "3.0.0-nightly.20251201.2",
30
+ "@aztec/aztec": "3.0.0-nightly.20251201.2",
31
+ "@aztec/aztec-node": "3.0.0-nightly.20251201.2",
32
+ "@aztec/aztec.js": "3.0.0-nightly.20251201.2",
33
+ "@aztec/bb-prover": "3.0.0-nightly.20251201.2",
34
+ "@aztec/bb.js": "3.0.0-nightly.20251201.2",
35
+ "@aztec/blob-lib": "3.0.0-nightly.20251201.2",
36
+ "@aztec/blob-sink": "3.0.0-nightly.20251201.2",
37
+ "@aztec/bot": "3.0.0-nightly.20251201.2",
38
+ "@aztec/cli": "3.0.0-nightly.20251201.2",
39
+ "@aztec/constants": "3.0.0-nightly.20251201.2",
40
+ "@aztec/entrypoints": "3.0.0-nightly.20251201.2",
41
+ "@aztec/epoch-cache": "3.0.0-nightly.20251201.2",
42
+ "@aztec/ethereum": "3.0.0-nightly.20251201.2",
43
+ "@aztec/foundation": "3.0.0-nightly.20251201.2",
44
+ "@aztec/kv-store": "3.0.0-nightly.20251201.2",
45
+ "@aztec/l1-artifacts": "3.0.0-nightly.20251201.2",
46
+ "@aztec/merkle-tree": "3.0.0-nightly.20251201.2",
47
+ "@aztec/node-keystore": "3.0.0-nightly.20251201.2",
48
+ "@aztec/noir-contracts.js": "3.0.0-nightly.20251201.2",
49
+ "@aztec/noir-noirc_abi": "3.0.0-nightly.20251201.2",
50
+ "@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251201.2",
51
+ "@aztec/noir-test-contracts.js": "3.0.0-nightly.20251201.2",
52
+ "@aztec/p2p": "3.0.0-nightly.20251201.2",
53
+ "@aztec/protocol-contracts": "3.0.0-nightly.20251201.2",
54
+ "@aztec/prover-client": "3.0.0-nightly.20251201.2",
55
+ "@aztec/prover-node": "3.0.0-nightly.20251201.2",
56
+ "@aztec/pxe": "3.0.0-nightly.20251201.2",
57
+ "@aztec/sequencer-client": "3.0.0-nightly.20251201.2",
58
+ "@aztec/simulator": "3.0.0-nightly.20251201.2",
59
+ "@aztec/slasher": "3.0.0-nightly.20251201.2",
60
+ "@aztec/stdlib": "3.0.0-nightly.20251201.2",
61
+ "@aztec/telemetry-client": "3.0.0-nightly.20251201.2",
62
+ "@aztec/test-wallet": "3.0.0-nightly.20251201.2",
63
+ "@aztec/validator-client": "3.0.0-nightly.20251201.2",
64
+ "@aztec/world-state": "3.0.0-nightly.20251201.2",
65
65
  "@iarna/toml": "^2.2.5",
66
66
  "@jest/globals": "^30.0.0",
67
67
  "@noble/curves": "=1.0.0",
@@ -107,6 +107,7 @@
107
107
  "@types/jest": "^30.0.0",
108
108
  "@types/js-yaml": "^4.0.9",
109
109
  "@types/lodash.chunk": "^4.2.9",
110
+ "@typescript/native-preview": "7.0.0-dev.20251126.1",
110
111
  "concurrently": "^7.6.0",
111
112
  "jest": "^30.0.0",
112
113
  "jest-extended": "^6.0.0",
@@ -9,6 +9,7 @@ import { EpochCache } from '@aztec/epoch-cache';
9
9
  import { DefaultL1ContractsConfig, type ExtendedViemWalletClient, createExtendedL1Client } from '@aztec/ethereum';
10
10
  import { RollupContract } from '@aztec/ethereum/contracts';
11
11
  import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp, withDelayer } from '@aztec/ethereum/test';
12
+ import { EpochNumber } from '@aztec/foundation/branded-types';
12
13
  import { SecretValue } from '@aztec/foundation/config';
13
14
  import { randomBytes } from '@aztec/foundation/crypto';
14
15
  import { withLogNameSuffix } from '@aztec/foundation/log';
@@ -279,7 +280,7 @@ export class EpochsTestContext {
279
280
 
280
281
  /** Waits until the epoch begins (ie until the immediately previous L1 block is mined). */
281
282
  public async waitUntilEpochStarts(epoch: number) {
282
- const [start] = getTimestampRangeForEpoch(BigInt(epoch), this.constants);
283
+ const [start] = getTimestampRangeForEpoch(EpochNumber(epoch), this.constants);
283
284
  this.logger.info(`Waiting until L1 timestamp ${start} is reached as the start of epoch ${epoch}`);
284
285
  await waitUntilL1Timestamp(
285
286
  this.l1Client,
@@ -313,7 +314,7 @@ export class EpochsTestContext {
313
314
 
314
315
  /** Waits until the last slot of the proof submission window for a given epoch. */
315
316
  public async waitUntilLastSlotOfProofSubmissionWindow(epochNumber: number | bigint) {
316
- const deadline = getProofSubmissionDeadlineTimestamp(BigInt(epochNumber), this.constants);
317
+ const deadline = getProofSubmissionDeadlineTimestamp(EpochNumber.fromBigInt(BigInt(epochNumber)), this.constants);
317
318
  const oneSlotBefore = deadline - BigInt(this.constants.slotDuration);
318
319
  const date = new Date(Number(oneSlotBefore) * 1000);
319
320
  this.logger.info(`Waiting until last slot of submission window for epoch ${epochNumber} at ${date}`, {
@@ -1,7 +1,7 @@
1
1
  import { AztecAddress } from '@aztec/aztec.js/addresses';
2
2
  import type { L2Block } from '@aztec/aztec.js/block';
3
3
  import { Fr } from '@aztec/aztec.js/fields';
4
- import { BatchedBlob, Blob, getPrefixedEthBlobCommitments } from '@aztec/blob-lib';
4
+ import { BatchedBlob, Blob, getEthBlobEvaluationInputs, getPrefixedEthBlobCommitments } from '@aztec/blob-lib';
5
5
  import { EthAddress } from '@aztec/foundation/eth-address';
6
6
 
7
7
  import { writeFile } from 'fs/promises';
@@ -46,7 +46,7 @@ export async function writeJson(
46
46
  // This should not be a problem for testing as long as the values are not larger than u32.
47
47
  archive: asHex(block.archive.root),
48
48
  blobCommitments: getPrefixedEthBlobCommitments(blobs),
49
- batchedBlobInputs: batchedBlob.getEthBlobEvaluationInputs(),
49
+ batchedBlobInputs: getEthBlobEvaluationInputs(batchedBlob),
50
50
  checkpointNumber: block.number,
51
51
  body: `0x${block.body.toBuffer().toString('hex')}`,
52
52
  header: {
@@ -1,6 +1,7 @@
1
1
  import type { AztecNodeService } from '@aztec/aztec-node';
2
2
  import { EthAddress } from '@aztec/aztec.js/addresses';
3
3
  import { RollupContract } from '@aztec/ethereum';
4
+ import { EpochNumber } from '@aztec/foundation/branded-types';
4
5
 
5
6
  import fs from 'fs';
6
7
  import 'jest-extended';
@@ -150,8 +151,11 @@ export class P2PInactivityTest {
150
151
  // This prevents race conditions where validators propose blocks before the network is ready
151
152
  await this.test.waitForP2PMeshConnectivity(this.nodes, NUM_NODES);
152
153
 
153
- this.test.logger.warn(`Advancing to epoch ${SETUP_EPOCH_DURATION + 1} to start slashing`);
154
- await this.test.ctx.cheatCodes.rollup.advanceToEpoch(SETUP_EPOCH_DURATION + 1);
154
+ const ethereumSlotDuration = this.test.ctx.aztecNodeConfig.ethereumSlotDuration!;
155
+ this.test.logger.warn(`Advancing to the L1 slot before epoch ${SETUP_EPOCH_DURATION + 1} to start slashing`);
156
+ await this.test.ctx.cheatCodes.rollup.advanceToEpoch(EpochNumber(SETUP_EPOCH_DURATION + 1), {
157
+ offset: -ethereumSlotDuration,
158
+ });
155
159
 
156
160
  return this;
157
161
  }
@@ -16,6 +16,7 @@ import {
16
16
  getL1ContractsConfigEnvVars,
17
17
  } from '@aztec/ethereum';
18
18
  import { ChainMonitor } from '@aztec/ethereum/test';
19
+ import { EpochNumber } from '@aztec/foundation/branded-types';
19
20
  import { SecretValue } from '@aztec/foundation/config';
20
21
  import { type Logger, createLogger } from '@aztec/foundation/log';
21
22
  import { retryUntil } from '@aztec/foundation/retry';
@@ -292,7 +293,9 @@ export class P2PNetworkTest {
292
293
  });
293
294
 
294
295
  await cheatCodes.rollup.advanceToEpoch(
295
- (await cheatCodes.rollup.getEpoch()) + (await rollup.read.getLagInEpochsForValidatorSet()) + 1n,
296
+ EpochNumber.fromBigInt(
297
+ BigInt(await cheatCodes.rollup.getEpoch()) + (await rollup.read.getLagInEpochsForValidatorSet()) + 1n,
298
+ ),
296
299
  );
297
300
 
298
301
  // Send and await a tx to make sure we mine a block for the warp to correctly progress.
@@ -7,6 +7,7 @@ import type { Logger } from '@aztec/aztec.js/log';
7
7
  import { Tx, TxStatus } from '@aztec/aztec.js/tx';
8
8
  import type { RollupCheatCodes } from '@aztec/aztec/testing';
9
9
  import type { EmpireSlashingProposerContract, RollupContract, TallySlashingProposerContract } from '@aztec/ethereum';
10
+ import { EpochNumber } from '@aztec/foundation/branded-types';
10
11
  import { timesAsync, unique } from '@aztec/foundation/collection';
11
12
  import { retryUntil } from '@aztec/foundation/retry';
12
13
  import { pluralize } from '@aztec/foundation/string';
@@ -213,9 +214,9 @@ export async function awaitCommitteeKicked({
213
214
 
214
215
  if (slashingProposer.type === 'empire') {
215
216
  // Await for the slash payload to be created if empire (no payload is created on tally until execution time)
216
- const targetEpoch = (await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1n;
217
+ const targetEpoch = BigInt(await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1n;
217
218
  logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
218
- await cheatCodes.advanceToEpoch(targetEpoch);
219
+ await cheatCodes.advanceToEpoch(EpochNumber.fromBigInt(targetEpoch));
219
220
 
220
221
  const slashPayloadEvents = await retryUntil(
221
222
  async () => {
@@ -239,7 +240,7 @@ export async function awaitCommitteeKicked({
239
240
  const firstEpochInOffenseRound = offenseEpoch - (offenseEpoch % slashingRoundSizeInEpochs);
240
241
  const targetEpoch = firstEpochInOffenseRound + slashingOffsetInEpochs;
241
242
  logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
242
- await cheatCodes.advanceToEpoch(targetEpoch, { offset: -aztecSlotDuration / 2 });
243
+ await cheatCodes.advanceToEpoch(EpochNumber(targetEpoch), { offset: -aztecSlotDuration / 2 });
243
244
  }
244
245
 
245
246
  const attestersPre = await rollup.getAttesters();
@@ -269,7 +270,9 @@ export async function awaitCommitteeKicked({
269
270
 
270
271
  logger.info(`Advancing to check current committee`);
271
272
  await cheatCodes.debugRollup();
272
- await cheatCodes.advanceToEpoch((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1n);
273
+ await cheatCodes.advanceToEpoch(
274
+ EpochNumber.fromBigInt(BigInt(await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1n),
275
+ );
273
276
  await cheatCodes.debugRollup();
274
277
 
275
278
  const committeeNextEpoch = await rollup.getCurrentEpochCommittee();
@@ -32,6 +32,7 @@ import {
32
32
  createDelayedL1TxUtilsFromViemWallet,
33
33
  startAnvil,
34
34
  } from '@aztec/ethereum/test';
35
+ import { EpochNumber } from '@aztec/foundation/branded-types';
35
36
  import { SecretValue } from '@aztec/foundation/config';
36
37
  import { randomBytes } from '@aztec/foundation/crypto';
37
38
  import { EthAddress } from '@aztec/foundation/eth-address';
@@ -647,7 +648,9 @@ export async function setup(
647
648
  ) {
648
649
  // We need to advance such that the committee is set up.
649
650
  await cheatCodes.rollup.advanceToEpoch(
650
- (await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1),
651
+ EpochNumber.fromBigInt(
652
+ BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1),
653
+ ),
651
654
  );
652
655
  await cheatCodes.rollup.setupEpoch();
653
656
  await cheatCodes.rollup.debugRollup();
@@ -3,6 +3,7 @@ import { AztecAddress } from '@aztec/aztec.js/addresses';
3
3
  import { Fr } from '@aztec/aztec.js/fields';
4
4
  import { CheatCodes } from '@aztec/aztec/testing';
5
5
  import type { RollupContract } from '@aztec/ethereum';
6
+ import { SlotNumber } from '@aztec/foundation/branded-types';
6
7
  import { pedersenHash } from '@aztec/foundation/crypto';
7
8
  import type { TestDateProvider } from '@aztec/foundation/timer';
8
9
  import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
@@ -103,7 +104,8 @@ export class LendingSimulator {
103
104
  }
104
105
 
105
106
  const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.timestamp()));
106
- const ts = Number(await this.rollup.getTimestampForSlot(slot + BigInt(diff)));
107
+ const targetSlot = SlotNumber(slot + diff);
108
+ const ts = Number(await this.rollup.getTimestampForSlot(targetSlot));
107
109
  const timeDiff = ts - this.time;
108
110
  this.time = ts;
109
111
 
@@ -2,6 +2,7 @@ import { createLogger } from '@aztec/aztec.js/log';
2
2
  import type { RollupCheatCodes } from '@aztec/aztec/testing';
3
3
  import type { L1ContractAddresses, ViemPublicClient } from '@aztec/ethereum';
4
4
  import type { Logger } from '@aztec/foundation/log';
5
+ import { promiseWithResolvers } from '@aztec/foundation/promise';
5
6
  import { makeBackoff, retry } from '@aztec/foundation/retry';
6
7
  import { schemas } from '@aztec/foundation/schemas';
7
8
  import { sleep } from '@aztec/foundation/sleep';
@@ -160,6 +161,39 @@ export async function startPortForward({
160
161
  return { process, port };
161
162
  }
162
163
 
164
+ export function getExternalIP(namespace: string, serviceName: string): Promise<string> {
165
+ const { promise, resolve, reject } = promiseWithResolvers<string>();
166
+ const process = spawn(
167
+ 'kubectl',
168
+ [
169
+ 'get',
170
+ 'service',
171
+ '-n',
172
+ namespace,
173
+ `${namespace}-${serviceName}`,
174
+ '--output',
175
+ "jsonpath='{.status.loadBalancer.ingress[0].ip}'",
176
+ ],
177
+ {
178
+ stdio: 'pipe',
179
+ },
180
+ );
181
+
182
+ let ip = '';
183
+ process.stdout.on('data', data => {
184
+ ip += data;
185
+ });
186
+ process.on('error', err => {
187
+ reject(err);
188
+ });
189
+ process.on('exit', () => {
190
+ // kubectl prints JSON. Remove the quotes
191
+ resolve(ip.replace(/"|'/g, ''));
192
+ });
193
+
194
+ return promise;
195
+ }
196
+
163
197
  export function startPortForwardForRPC(namespace: string, resourceType = 'services', index = 0) {
164
198
  return startPortForward({
165
199
  resource: `${resourceType}/${namespace}-rpc-aztec-node-${index}`,
@@ -295,6 +329,32 @@ async function execHelmCommand(args: Parameters<typeof createHelmCommand>[0]) {
295
329
  return stdout;
296
330
  }
297
331
 
332
+ export async function cleanHelm(instanceName: string, namespace: string, logger: Logger) {
333
+ // uninstall the helm chart if it exists
334
+ logger.info(`Uninstalling helm chart ${instanceName}`);
335
+ await execAsync(`helm uninstall ${instanceName} --namespace ${namespace} --wait --ignore-not-found`);
336
+ // and delete the chaos-mesh resources created by this release
337
+ const deleteByLabel = async (resource: string) => {
338
+ const args = {
339
+ resource,
340
+ namespace: namespace,
341
+ label: `app.kubernetes.io/instance=${instanceName}`,
342
+ } as const;
343
+ logger.info(`Deleting ${resource} resources for release ${instanceName}`);
344
+ await deleteResourceByLabel(args).catch(e => {
345
+ logger.error(`Error deleting ${resource}: ${e}`);
346
+ logger.info(`Force deleting ${resource}`);
347
+ return deleteResourceByLabel({ ...args, force: true });
348
+ });
349
+ };
350
+
351
+ await deleteByLabel('podchaos');
352
+ await deleteByLabel('networkchaos');
353
+ await deleteByLabel('podnetworkchaos');
354
+ await deleteByLabel('workflows');
355
+ await deleteByLabel('workflownodes');
356
+ }
357
+
298
358
  /**
299
359
  * Installs a Helm chart with the given parameters.
300
360
  * @param instanceName - The name of the Helm chart instance.
@@ -317,7 +377,6 @@ export async function installChaosMeshChart({
317
377
  targetNamespace,
318
378
  valuesFile,
319
379
  helmChartDir,
320
- chaosMeshNamespace = 'chaos-mesh',
321
380
  timeout = '10m',
322
381
  clean = true,
323
382
  values = {},
@@ -334,32 +393,13 @@ export async function installChaosMeshChart({
334
393
  logger: Logger;
335
394
  }) {
336
395
  if (clean) {
337
- // uninstall the helm chart if it exists
338
- logger.info(`Uninstalling helm chart ${instanceName}`);
339
- await execAsync(`helm uninstall ${instanceName} --namespace ${chaosMeshNamespace} --wait --ignore-not-found`);
340
- // and delete the chaos-mesh resources created by this release
341
- const deleteByLabel = async (resource: string) => {
342
- const args = {
343
- resource,
344
- namespace: chaosMeshNamespace,
345
- label: `app.kubernetes.io/instance=${instanceName}`,
346
- } as const;
347
- logger.info(`Deleting ${resource} resources for release ${instanceName}`);
348
- await deleteResourceByLabel(args).catch(e => {
349
- logger.error(`Error deleting ${resource}: ${e}`);
350
- logger.info(`Force deleting ${resource}`);
351
- return deleteResourceByLabel({ ...args, force: true });
352
- });
353
- };
354
-
355
- await deleteByLabel('podchaos');
356
- await deleteByLabel('networkchaos');
396
+ await cleanHelm(instanceName, targetNamespace, logger);
357
397
  }
358
398
 
359
399
  return execHelmCommand({
360
400
  instanceName,
361
401
  helmChartDir,
362
- namespace: chaosMeshNamespace,
402
+ namespace: targetNamespace,
363
403
  valuesFile,
364
404
  timeout,
365
405
  values: { ...values, 'global.targetNamespace': targetNamespace },