@aztec/end-to-end 3.0.0-devnet.2 → 3.0.0-devnet.20251212

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 (149) 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/benchmark.js +2 -2
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +9 -2
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  6. package/dest/bench/client_flows/client_flows_benchmark.js +58 -33
  7. package/dest/bench/client_flows/config.d.ts +1 -1
  8. package/dest/bench/client_flows/data_extractor.d.ts +1 -1
  9. package/dest/bench/client_flows/data_extractor.js +8 -30
  10. package/dest/bench/utils.d.ts +2 -2
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
  12. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  13. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +2 -2
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +3 -2
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  16. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +6 -4
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  18. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  19. package/dest/e2e_epochs/epochs_test.d.ts +10 -9
  20. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  21. package/dest/e2e_epochs/epochs_test.js +11 -9
  22. package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
  23. package/dest/e2e_fees/bridging_race.notest.js +2 -2
  24. package/dest/e2e_fees/fees_test.d.ts +5 -3
  25. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  26. package/dest/e2e_fees/fees_test.js +14 -10
  27. package/dest/e2e_l1_publisher/write_json.d.ts +1 -1
  28. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  29. package/dest/e2e_l1_publisher/write_json.js +5 -4
  30. package/dest/e2e_multi_validator/utils.d.ts +1 -1
  31. package/dest/e2e_multi_validator/utils.js +1 -1
  32. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  33. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  34. package/dest/e2e_nested_contract/nested_contract_test.js +4 -3
  35. package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
  36. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  37. package/dest/e2e_p2p/inactivity_slash_test.js +6 -2
  38. package/dest/e2e_p2p/p2p_network.d.ts +218 -11
  39. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  40. package/dest/e2e_p2p/p2p_network.js +11 -5
  41. package/dest/e2e_p2p/shared.d.ts +6 -6
  42. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  43. package/dest/e2e_p2p/shared.js +6 -5
  44. package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
  45. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  46. package/dest/e2e_token_contract/token_contract_test.js +2 -2
  47. package/dest/fixtures/e2e_prover_test.d.ts +4 -2
  48. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  49. package/dest/fixtures/e2e_prover_test.js +18 -14
  50. package/dest/fixtures/fixtures.d.ts +1 -1
  51. package/dest/fixtures/fixtures.d.ts.map +1 -1
  52. package/dest/fixtures/fixtures.js +1 -1
  53. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  54. package/dest/fixtures/get_acvm_config.js +1 -1
  55. package/dest/fixtures/get_bb_config.d.ts +1 -1
  56. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  57. package/dest/fixtures/index.d.ts +1 -1
  58. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  59. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  60. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  61. package/dest/fixtures/logging.d.ts +1 -1
  62. package/dest/fixtures/setup_l1_contracts.d.ts +475 -4
  63. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  64. package/dest/fixtures/setup_l1_contracts.js +1 -1
  65. package/dest/fixtures/setup_p2p_test.d.ts +4 -4
  66. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  67. package/dest/fixtures/setup_p2p_test.js +18 -10
  68. package/dest/fixtures/snapshot_manager.d.ts +3 -3
  69. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  70. package/dest/fixtures/snapshot_manager.js +6 -4
  71. package/dest/fixtures/token_utils.d.ts +5 -2
  72. package/dest/fixtures/token_utils.d.ts.map +1 -1
  73. package/dest/fixtures/token_utils.js +7 -4
  74. package/dest/fixtures/utils.d.ts +453 -7
  75. package/dest/fixtures/utils.d.ts.map +1 -1
  76. package/dest/fixtures/utils.js +26 -19
  77. package/dest/fixtures/web3signer.d.ts +1 -1
  78. package/dest/fixtures/web3signer.js +1 -1
  79. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  80. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  81. package/dest/fixtures/with_telemetry_utils.js +2 -2
  82. package/dest/index.d.ts +1 -1
  83. package/dest/quality_of_service/alert_checker.d.ts +1 -1
  84. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  85. package/dest/shared/cross_chain_test_harness.d.ts +5 -14
  86. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  87. package/dest/shared/cross_chain_test_harness.js +1 -1
  88. package/dest/shared/gas_portal_test_harness.d.ts +2 -12
  89. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  90. package/dest/shared/gas_portal_test_harness.js +1 -1
  91. package/dest/shared/index.d.ts +1 -1
  92. package/dest/shared/jest_setup.d.ts +1 -1
  93. package/dest/shared/submit-transactions.d.ts +1 -1
  94. package/dest/shared/submit-transactions.d.ts.map +1 -1
  95. package/dest/shared/uniswap_l1_l2.d.ts +3 -2
  96. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  97. package/dest/shared/uniswap_l1_l2.js +15 -13
  98. package/dest/simulators/index.d.ts +1 -1
  99. package/dest/simulators/lending_simulator.d.ts +2 -6
  100. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  101. package/dest/simulators/lending_simulator.js +5 -3
  102. package/dest/simulators/token_simulator.d.ts +1 -1
  103. package/dest/simulators/token_simulator.d.ts.map +1 -1
  104. package/dest/spartan/setup_test_wallets.d.ts +5 -3
  105. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  106. package/dest/spartan/setup_test_wallets.js +45 -10
  107. package/dest/spartan/tx_metrics.d.ts +39 -0
  108. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  109. package/dest/spartan/tx_metrics.js +95 -0
  110. package/dest/spartan/utils.d.ts +31 -21
  111. package/dest/spartan/utils.d.ts.map +1 -1
  112. package/dest/spartan/utils.js +93 -33
  113. package/package.json +42 -40
  114. package/src/bench/client_flows/benchmark.ts +2 -2
  115. package/src/bench/client_flows/client_flows_benchmark.ts +80 -33
  116. package/src/bench/client_flows/data_extractor.ts +9 -31
  117. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +2 -2
  118. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +7 -6
  119. package/src/e2e_deploy_contract/deploy_test.ts +1 -1
  120. package/src/e2e_epochs/epochs_test.ts +19 -16
  121. package/src/e2e_fees/bridging_race.notest.ts +2 -2
  122. package/src/e2e_fees/fees_test.ts +18 -12
  123. package/src/e2e_l1_publisher/write_json.ts +5 -4
  124. package/src/e2e_multi_validator/utils.ts +1 -1
  125. package/src/e2e_nested_contract/nested_contract_test.ts +4 -3
  126. package/src/e2e_p2p/inactivity_slash_test.ts +9 -3
  127. package/src/e2e_p2p/p2p_network.ts +15 -12
  128. package/src/e2e_p2p/shared.ts +13 -6
  129. package/src/e2e_token_contract/token_contract_test.ts +2 -2
  130. package/src/fixtures/e2e_prover_test.ts +16 -17
  131. package/src/fixtures/fixtures.ts +1 -2
  132. package/src/fixtures/get_acvm_config.ts +1 -1
  133. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  134. package/src/fixtures/setup_l1_contracts.ts +2 -1
  135. package/src/fixtures/setup_p2p_test.ts +23 -9
  136. package/src/fixtures/snapshot_manager.ts +7 -10
  137. package/src/fixtures/token_utils.ts +4 -4
  138. package/src/fixtures/utils.ts +51 -31
  139. package/src/fixtures/web3signer.ts +1 -1
  140. package/src/fixtures/with_telemetry_utils.ts +2 -2
  141. package/src/guides/up_quick_start.sh +1 -1
  142. package/src/shared/cross_chain_test_harness.ts +5 -2
  143. package/src/shared/gas_portal_test_harness.ts +2 -2
  144. package/src/shared/uniswap_l1_l2.ts +16 -19
  145. package/src/simulators/lending_simulator.ts +6 -4
  146. package/src/spartan/DEVELOP.md +7 -0
  147. package/src/spartan/setup_test_wallets.ts +49 -12
  148. package/src/spartan/tx_metrics.ts +130 -0
  149. package/src/spartan/utils.ts +107 -33
@@ -73,6 +73,6 @@ export class DeployTest {
73
73
  export type StatefulContractCtorArgs = Parameters<StatefulTestContract['methods']['constructor']>;
74
74
 
75
75
  export type ContractArtifactClass<T extends ContractBase> = {
76
- at(address: AztecAddress, wallet: Wallet): Promise<T>;
76
+ at(address: AztecAddress, wallet: Wallet): T;
77
77
  artifact: ContractArtifact;
78
78
  };
@@ -6,11 +6,14 @@ import type { Logger } from '@aztec/aztec.js/log';
6
6
  import { MerkleTreeId } from '@aztec/aztec.js/trees';
7
7
  import type { Wallet } from '@aztec/aztec.js/wallet';
8
8
  import { EpochCache } from '@aztec/epoch-cache';
9
- import { DefaultL1ContractsConfig, type ExtendedViemWalletClient, createExtendedL1Client } from '@aztec/ethereum';
9
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
10
+ import { DefaultL1ContractsConfig } from '@aztec/ethereum/config';
10
11
  import { RollupContract } from '@aztec/ethereum/contracts';
11
12
  import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp, withDelayer } from '@aztec/ethereum/test';
13
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
14
+ import { BlockNumber, CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
12
15
  import { SecretValue } from '@aztec/foundation/config';
13
- import { randomBytes } from '@aztec/foundation/crypto';
16
+ import { randomBytes } from '@aztec/foundation/crypto/random';
14
17
  import { withLogNameSuffix } from '@aztec/foundation/log';
15
18
  import { retryUntil } from '@aztec/foundation/retry';
16
19
  import { sleep } from '@aztec/foundation/sleep';
@@ -25,7 +28,7 @@ import {
25
28
  SequencerState,
26
29
  } from '@aztec/sequencer-client';
27
30
  import type { TestSequencerClient } from '@aztec/sequencer-client/test';
28
- import { EthAddress, type L2BlockNumber } from '@aztec/stdlib/block';
31
+ import { type BlockParameter, EthAddress } from '@aztec/stdlib/block';
29
32
  import { type L1RollupConstants, getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
30
33
  import { tryStop } from '@aztec/stdlib/interfaces/server';
31
34
 
@@ -279,7 +282,7 @@ export class EpochsTestContext {
279
282
 
280
283
  /** Waits until the epoch begins (ie until the immediately previous L1 block is mined). */
281
284
  public async waitUntilEpochStarts(epoch: number) {
282
- const [start] = getTimestampRangeForEpoch(BigInt(epoch), this.constants);
285
+ const [start] = getTimestampRangeForEpoch(EpochNumber(epoch), this.constants);
283
286
  this.logger.info(`Waiting until L1 timestamp ${start} is reached as the start of epoch ${epoch}`);
284
287
  await waitUntilL1Timestamp(
285
288
  this.l1Client,
@@ -290,30 +293,30 @@ export class EpochsTestContext {
290
293
  return start;
291
294
  }
292
295
 
293
- /** Waits until the given L2 block number is mined. */
294
- public async waitUntilL2BlockNumber(target: number, timeout = 60) {
296
+ /** Waits until the given checkpoint number is mined. */
297
+ public async waitUntilCheckpointNumber(target: CheckpointNumber, timeout = 60) {
295
298
  await retryUntil(
296
- () => Promise.resolve(target <= this.monitor.l2BlockNumber),
297
- `Wait until L2 block ${target}`,
299
+ () => Promise.resolve(target <= this.monitor.checkpointNumber),
300
+ `Wait until checkpoint ${target}`,
298
301
  timeout,
299
302
  0.1,
300
303
  );
301
304
  }
302
305
 
303
- /** Waits until the given L2 block number is marked as proven. */
304
- public async waitUntilProvenL2BlockNumber(t: number, timeout = 60) {
306
+ /** Waits until the given checkpoint number is marked as proven. */
307
+ public async waitUntilProvenCheckpointNumber(target: CheckpointNumber, timeout = 60) {
305
308
  await retryUntil(
306
- () => Promise.resolve(t <= this.monitor.l2ProvenBlockNumber),
307
- `Wait proven L2 block ${t}`,
309
+ () => Promise.resolve(target <= this.monitor.provenCheckpointNumber),
310
+ `Wait proven checkpoint ${target}`,
308
311
  timeout,
309
312
  0.1,
310
313
  );
311
- return this.monitor.l2ProvenBlockNumber;
314
+ return this.monitor.provenCheckpointNumber;
312
315
  }
313
316
 
314
317
  /** Waits until the last slot of the proof submission window for a given epoch. */
315
318
  public async waitUntilLastSlotOfProofSubmissionWindow(epochNumber: number | bigint) {
316
- const deadline = getProofSubmissionDeadlineTimestamp(BigInt(epochNumber), this.constants);
319
+ const deadline = getProofSubmissionDeadlineTimestamp(EpochNumber.fromBigInt(BigInt(epochNumber)), this.constants);
317
320
  const oneSlotBefore = deadline - BigInt(this.constants.slotDuration);
318
321
  const date = new Date(Number(oneSlotBefore) * 1000);
319
322
  this.logger.info(`Waiting until last slot of submission window for epoch ${epochNumber} at ${date}`, {
@@ -323,7 +326,7 @@ export class EpochsTestContext {
323
326
  }
324
327
 
325
328
  /** Waits for the aztec node to sync to the target block number. */
326
- public async waitForNodeToSync(blockNumber: number, type: 'proven' | 'finalized' | 'historic') {
329
+ public async waitForNodeToSync(blockNumber: BlockNumber, type: 'proven' | 'finalized' | 'historic') {
327
330
  const waitTime = ARCHIVER_POLL_INTERVAL + WORLD_STATE_BLOCK_CHECK_INTERVAL;
328
331
  let synched = false;
329
332
  while (!synched) {
@@ -372,7 +375,7 @@ export class EpochsTestContext {
372
375
  }
373
376
 
374
377
  /** Verifies whether the given block number is found on the aztec node. */
375
- public async verifyHistoricBlock(blockNumber: L2BlockNumber, expectedSuccess: boolean) {
378
+ public async verifyHistoricBlock(blockNumber: BlockParameter, expectedSuccess: boolean) {
376
379
  // We use `findLeavesIndexes` here, but could use any function that queries the world-state
377
380
  // at a particular block, so we know whether that historic block is available or has been
378
381
  // pruned. Note that `getBlock` would not work here, since it only hits the archiver.
@@ -1,7 +1,7 @@
1
1
  import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
2
2
  import { Fr } from '@aztec/aztec.js/fields';
3
3
  import type { Logger } from '@aztec/aztec.js/log';
4
- import { Fq } from '@aztec/foundation/fields';
4
+ import { Fq } from '@aztec/foundation/curves/bn254';
5
5
  import { sleep } from '@aztec/foundation/sleep';
6
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
7
  import type { TestWallet } from '@aztec/test-wallet/server';
@@ -60,7 +60,7 @@ describe('e2e_fees bridging_race', () => {
60
60
  const origApprove = l1TokenManager.approve.bind(l1TokenManager);
61
61
  l1TokenManager.approve = async (amount: bigint, address: Hex, addressName = '') => {
62
62
  await origApprove(amount, address, addressName);
63
- const sleepTime = (Number(t.chainMonitor.l2BlockTimestamp) + AZTEC_SLOT_DURATION) * 1000 - Date.now() - 500;
63
+ const sleepTime = (Number(t.chainMonitor.checkpointTimestamp) + AZTEC_SLOT_DURATION) * 1000 - Date.now() - 500;
64
64
  logger.info(`Sleeping for ${sleepTime}ms until near end of L2 slot before sending L1 fee juice to L2 inbox`);
65
65
  await sleep(sleepTime);
66
66
  };
@@ -2,8 +2,11 @@ import type { AztecAddress } from '@aztec/aztec.js/addresses';
2
2
  import { type Logger, createLogger } from '@aztec/aztec.js/log';
3
3
  import type { AztecNode } from '@aztec/aztec.js/node';
4
4
  import { CheatCodes } from '@aztec/aztec/testing';
5
- import { type DeployL1ContractsArgs, RollupContract, createExtendedL1Client } from '@aztec/ethereum';
5
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
6
+ import { RollupContract } from '@aztec/ethereum/contracts';
7
+ import type { DeployL1ContractsArgs } from '@aztec/ethereum/deploy-l1-contracts';
6
8
  import { ChainMonitor } from '@aztec/ethereum/test';
9
+ import { BlockNumber } from '@aztec/foundation/branded-types';
7
10
  import { EthAddress } from '@aztec/foundation/eth-address';
8
11
  import { sleep } from '@aztec/foundation/sleep';
9
12
  import { TestERC20Abi } from '@aztec/l1-artifacts';
@@ -85,7 +88,7 @@ export class FeesTest {
85
88
  public getGasBalanceFn!: BalancesFn;
86
89
  public getBananaPublicBalanceFn!: BalancesFn;
87
90
  public getBananaPrivateBalanceFn!: BalancesFn;
88
- public getProverFee!: (blockNumber: number) => Promise<bigint>;
91
+ public getProverFee!: (blockNumber: BlockNumber) => Promise<bigint>;
89
92
 
90
93
  public readonly ALICE_INITIAL_BANANAS = BigInt(1e22);
91
94
  public readonly SUBSCRIPTION_AMOUNT = BigInt(1e19);
@@ -136,7 +139,7 @@ export class FeesTest {
136
139
  }
137
140
 
138
141
  async getBlockRewards() {
139
- const blockReward = await this.rollupContract.getBlockReward();
142
+ const blockReward = await this.rollupContract.getCheckpointReward();
140
143
  const rewardConfig = await this.rollupContract.getRewardConfig();
141
144
 
142
145
  const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(
@@ -197,7 +200,7 @@ export class FeesTest {
197
200
  this.fpcAdmin = this.aliceAddress;
198
201
 
199
202
  const canonicalFeeJuice = await getCanonicalFeeJuice();
200
- this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
203
+ this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
201
204
  },
202
205
  );
203
206
  }
@@ -215,7 +218,7 @@ export class FeesTest {
215
218
  async (_data, context) => {
216
219
  this.context = context;
217
220
 
218
- this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
221
+ this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
219
222
 
220
223
  this.getGasBalanceFn = getBalancesFn(
221
224
  '⛽',
@@ -245,8 +248,8 @@ export class FeesTest {
245
248
  this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
246
249
  return { bananaCoinAddress: bananaCoin.address };
247
250
  },
248
- async ({ bananaCoinAddress }) => {
249
- this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.wallet);
251
+ ({ bananaCoinAddress }) => {
252
+ this.bananaCoin = BananaCoin.at(bananaCoinAddress, this.wallet);
250
253
  const logger = this.logger;
251
254
  this.getBananaPublicBalanceFn = getBalancesFn(
252
255
  '🍌.public',
@@ -260,6 +263,7 @@ export class FeesTest {
260
263
  this.aliceAddress,
261
264
  logger,
262
265
  );
266
+ return Promise.resolve();
263
267
  },
264
268
  );
265
269
  }
@@ -287,8 +291,8 @@ export class FeesTest {
287
291
  rollupAddress: context.deployL1ContractsValues.l1ContractAddresses.rollupAddress,
288
292
  };
289
293
  },
290
- async (data, context) => {
291
- const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.wallet);
294
+ (data, context) => {
295
+ const bananaFPC = FPCContract.at(data.bananaFPCAddress, this.wallet);
292
296
  this.bananaFPC = bananaFPC;
293
297
 
294
298
  this.getCoinbaseBalance = async () => {
@@ -305,7 +309,7 @@ export class FeesTest {
305
309
  return await this.rollupContract.getSequencerRewards(this.coinbase);
306
310
  };
307
311
 
308
- this.getProverFee = async (blockNumber: number) => {
312
+ this.getProverFee = async (blockNumber: BlockNumber) => {
309
313
  const block = await this.aztecNode.getBlock(blockNumber);
310
314
 
311
315
  // @todo @lherskind As we deal with #13601
@@ -328,6 +332,7 @@ export class FeesTest {
328
332
  const mana = block!.header.totalManaUsed.toBigInt();
329
333
  return mulDiv(mana * proverCost, price, 10n ** 9n);
330
334
  };
335
+ return Promise.resolve();
331
336
  },
332
337
  );
333
338
  }
@@ -346,8 +351,9 @@ export class FeesTest {
346
351
  sponsoredFPCAddress: sponsoredFPC.address,
347
352
  };
348
353
  },
349
- async data => {
350
- this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
354
+ data => {
355
+ this.sponsoredFPC = SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
356
+ return Promise.resolve();
351
357
  },
352
358
  );
353
359
  }
@@ -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';
@@ -41,16 +41,17 @@ export async function writeJson(
41
41
  messages: {
42
42
  l2ToL1Messages: block.body.txEffects.flatMap(txEffect => txEffect.l2ToL1Msgs).map(value => asHex(value)),
43
43
  },
44
- block: {
44
+ checkpoint: {
45
45
  // The json formatting in forge is a bit brittle, so we convert Fr to a number in the few values below.
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(),
50
- blockNumber: block.number,
49
+ batchedBlobInputs: getEthBlobEvaluationInputs(batchedBlob),
50
+ checkpointNumber: block.number,
51
51
  body: `0x${block.body.toBuffer().toString('hex')}`,
52
52
  header: {
53
53
  lastArchiveRoot: asHex(block.header.lastArchive.root),
54
+ blockHeadersHash: asHex(block.header.blockHeadersHash),
54
55
  contentCommitment: {
55
56
  blobsHash: asHex(block.header.contentCommitment.blobsHash),
56
57
  inHash: asHex(block.header.contentCommitment.inHash),
@@ -1,5 +1,5 @@
1
1
  import { AztecAddress } from '@aztec/aztec.js/addresses';
2
- import { getAddressFromPrivateKey } from '@aztec/ethereum';
2
+ import { getAddressFromPrivateKey } from '@aztec/ethereum/account';
3
3
  import { EthAddress } from '@aztec/foundation/eth-address';
4
4
  import type { EthPrivateKey } from '@aztec/node-keystore';
5
5
 
@@ -86,9 +86,10 @@ export class NestedContractTest {
86
86
  .deployed();
87
87
  return { parentContractAddress: parentContract.address, childContractAddress: childContract.address };
88
88
  },
89
- async ({ parentContractAddress, childContractAddress }) => {
90
- this.parentContract = await ParentContract.at(parentContractAddress, this.wallet);
91
- this.childContract = await ChildContract.at(childContractAddress, this.wallet);
89
+ ({ parentContractAddress, childContractAddress }) => {
90
+ this.parentContract = ParentContract.at(parentContractAddress, this.wallet);
91
+ this.childContract = ChildContract.at(childContractAddress, this.wallet);
92
+ return Promise.resolve();
92
93
  },
93
94
  );
94
95
  }
@@ -1,6 +1,7 @@
1
1
  import type { AztecNodeService } from '@aztec/aztec-node';
2
2
  import { EthAddress } from '@aztec/aztec.js/addresses';
3
- import { RollupContract } from '@aztec/ethereum';
3
+ import { RollupContract } from '@aztec/ethereum/contracts';
4
+ import { EpochNumber } from '@aztec/foundation/branded-types';
4
5
 
5
6
  import fs from 'fs';
6
7
  import 'jest-extended';
@@ -150,8 +151,13 @@ 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(
156
+ `Advancing to epoch ${SETUP_EPOCH_DURATION} (slashing will start after this epoch is complete)`,
157
+ );
158
+ await this.test.ctx.cheatCodes.rollup.advanceToEpoch(EpochNumber(SETUP_EPOCH_DURATION), {
159
+ offset: -ethereumSlotDuration,
160
+ });
155
161
 
156
162
  return this;
157
163
  }
@@ -2,20 +2,20 @@ import type { InitialAccountData } from '@aztec/accounts/testing';
2
2
  import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
3
3
  import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
4
4
  import { Fr } from '@aztec/aztec.js/fields';
5
+ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
5
6
  import {
6
7
  type EmpireSlashingProposerContract,
7
- type ExtendedViemWalletClient,
8
8
  GSEContract,
9
- MultiAdderArtifact,
10
- type Operator,
11
9
  RollupContract,
12
10
  type TallySlashingProposerContract,
13
- type ViemClient,
14
- createL1TxUtilsFromViemWallet,
15
- deployL1Contract,
16
- getL1ContractsConfigEnvVars,
17
- } from '@aztec/ethereum';
11
+ } from '@aztec/ethereum/contracts';
12
+ import type { Operator } from '@aztec/ethereum/deploy-l1-contracts';
13
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contracts';
14
+ import { MultiAdderArtifact } from '@aztec/ethereum/l1-artifacts';
15
+ import { createL1TxUtilsFromViemWallet } from '@aztec/ethereum/l1-tx-utils';
18
16
  import { ChainMonitor } from '@aztec/ethereum/test';
17
+ import type { ExtendedViemWalletClient, ViemClient } from '@aztec/ethereum/types';
18
+ import { EpochNumber } from '@aztec/foundation/branded-types';
19
19
  import { SecretValue } from '@aztec/foundation/config';
20
20
  import { type Logger, createLogger } from '@aztec/foundation/log';
21
21
  import { retryUntil } from '@aztec/foundation/retry';
@@ -200,7 +200,7 @@ export class P2PNetworkTest {
200
200
 
201
201
  async addBootstrapNode() {
202
202
  await this.snapshotManager.snapshot('add-bootstrap-node', async ({ aztecNodeConfig }) => {
203
- const telemetry = getEndToEndTestTelemetryClient(this.metricsPort);
203
+ const telemetry = await getEndToEndTestTelemetryClient(this.metricsPort);
204
204
  this.bootstrapNode = await createBootstrapNodeFromPrivateKey(
205
205
  BOOTSTRAP_NODE_PRIVATE_KEY,
206
206
  this.bootNodePort,
@@ -292,7 +292,9 @@ export class P2PNetworkTest {
292
292
  });
293
293
 
294
294
  await cheatCodes.rollup.advanceToEpoch(
295
- (await cheatCodes.rollup.getEpoch()) + (await rollup.read.getLagInEpochs()) + 1n,
295
+ EpochNumber.fromBigInt(
296
+ BigInt(await cheatCodes.rollup.getEpoch()) + (await rollup.read.getLagInEpochsForValidatorSet()) + 1n,
297
+ ),
296
298
  );
297
299
 
298
300
  // Send and await a tx to make sure we mine a block for the warp to correctly progress.
@@ -326,11 +328,12 @@ export class P2PNetworkTest {
326
328
  .deployed();
327
329
  return { contractAddress: spamContract.address };
328
330
  },
329
- async ({ contractAddress }) => {
331
+ ({ contractAddress }) => {
330
332
  if (!this.wallet) {
331
333
  throw new Error('Call snapshot t.setupAccount before deploying account contract');
332
334
  }
333
- this.spamContract = await SpamContract.at(contractAddress, this.wallet);
335
+ this.spamContract = SpamContract.at(contractAddress, this.wallet);
336
+ return Promise.resolve();
334
337
  },
335
338
  );
336
339
  }
@@ -6,7 +6,12 @@ import { Fr } from '@aztec/aztec.js/fields';
6
6
  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
- import type { EmpireSlashingProposerContract, RollupContract, TallySlashingProposerContract } from '@aztec/ethereum';
9
+ import type {
10
+ EmpireSlashingProposerContract,
11
+ RollupContract,
12
+ TallySlashingProposerContract,
13
+ } from '@aztec/ethereum/contracts';
14
+ import { EpochNumber } from '@aztec/foundation/branded-types';
10
15
  import { timesAsync, unique } from '@aztec/foundation/collection';
11
16
  import { retryUntil } from '@aztec/foundation/retry';
12
17
  import { pluralize } from '@aztec/foundation/string';
@@ -80,7 +85,7 @@ export async function prepareTransactions(
80
85
  salt: Fr.random(),
81
86
  });
82
87
  await wallet.registerContract(testContractInstance, TestContractArtifact);
83
- const contract = await TestContract.at(testContractInstance.address, wallet);
88
+ const contract = TestContract.at(testContractInstance.address, wallet);
84
89
 
85
90
  return timesAsync(numTxs, async () => {
86
91
  const tx = await proveInteraction(wallet, contract.methods.emit_nullifier(Fr.random()), {
@@ -213,9 +218,9 @@ export async function awaitCommitteeKicked({
213
218
 
214
219
  if (slashingProposer.type === 'empire') {
215
220
  // 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.getLagInEpochs()) + 1n;
221
+ const targetEpoch = BigInt(await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1n;
217
222
  logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
218
- await cheatCodes.advanceToEpoch(targetEpoch);
223
+ await cheatCodes.advanceToEpoch(EpochNumber.fromBigInt(targetEpoch));
219
224
 
220
225
  const slashPayloadEvents = await retryUntil(
221
226
  async () => {
@@ -239,7 +244,7 @@ export async function awaitCommitteeKicked({
239
244
  const firstEpochInOffenseRound = offenseEpoch - (offenseEpoch % slashingRoundSizeInEpochs);
240
245
  const targetEpoch = firstEpochInOffenseRound + slashingOffsetInEpochs;
241
246
  logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
242
- await cheatCodes.advanceToEpoch(targetEpoch, { offset: -aztecSlotDuration / 2 });
247
+ await cheatCodes.advanceToEpoch(EpochNumber(targetEpoch), { offset: -aztecSlotDuration / 2 });
243
248
  }
244
249
 
245
250
  const attestersPre = await rollup.getAttesters();
@@ -269,7 +274,9 @@ export async function awaitCommitteeKicked({
269
274
 
270
275
  logger.info(`Advancing to check current committee`);
271
276
  await cheatCodes.debugRollup();
272
- await cheatCodes.advanceToEpoch((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochs()) + 1n);
277
+ await cheatCodes.advanceToEpoch(
278
+ EpochNumber.fromBigInt(BigInt(await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1n),
279
+ );
273
280
  await cheatCodes.debugRollup();
274
281
 
275
282
  const committeeNextEpoch = await rollup.getCurrentEpochCommittee();
@@ -90,7 +90,7 @@ export class TokenContractTest {
90
90
  },
91
91
  async ({ tokenContractAddress, badAccountAddress }) => {
92
92
  // Restore the token contract state.
93
- this.asset = await TokenContract.at(tokenContractAddress, this.wallet);
93
+ this.asset = TokenContract.at(tokenContractAddress, this.wallet);
94
94
  this.logger.verbose(`Token contract address: ${this.asset.address}`);
95
95
 
96
96
  this.tokenSim = new TokenSimulator(this.asset, this.wallet, this.adminAddress, this.logger, [
@@ -98,7 +98,7 @@ export class TokenContractTest {
98
98
  this.account1Address,
99
99
  ]);
100
100
 
101
- this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallet);
101
+ this.badAccount = InvalidAccountContract.at(badAccountAddress, this.wallet);
102
102
  this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
103
103
 
104
104
  expect(await this.asset.methods.get_admin().simulate({ from: this.adminAddress })).toBe(
@@ -10,14 +10,16 @@ import {
10
10
  QueuedIVCVerifier,
11
11
  TestCircuitVerifier,
12
12
  } from '@aztec/bb-prover';
13
+ import { BackendType, Barretenberg } from '@aztec/bb.js';
13
14
  import { createBlobSinkClient } from '@aztec/blob-sink/client';
14
15
  import type { BlobSinkServer } from '@aztec/blob-sink/server';
15
- import type { DeployL1ContractsReturnType } from '@aztec/ethereum';
16
+ import type { DeployL1ContractsReturnType } from '@aztec/ethereum/deploy-l1-contracts';
16
17
  import { Buffer32 } from '@aztec/foundation/buffer';
17
18
  import { SecretValue } from '@aztec/foundation/config';
18
19
  import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
19
20
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
20
21
  import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
22
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
21
23
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
22
24
  import { TestWallet } from '@aztec/test-wallet/server';
23
25
  import { getGenesisValues } from '@aztec/world-state/testing';
@@ -62,6 +64,7 @@ export class FullProverTest {
62
64
  accounts: AztecAddress[] = [];
63
65
  deployedAccounts!: InitialAccountData[];
64
66
  fakeProofsAsset!: TokenContract;
67
+ fakeProofsAssetInstance!: ContractInstanceWithAddress;
65
68
  tokenSim!: TokenSimulator;
66
69
  aztecNode!: AztecNode;
67
70
  aztecNodeAdmin!: AztecNodeAdmin;
@@ -121,7 +124,7 @@ export class FullProverTest {
121
124
  await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
122
125
 
123
126
  this.logger.verbose(`Deploying TokenContract...`);
124
- const asset = await TokenContract.deploy(
127
+ const { contract: asset, instance } = await TokenContract.deploy(
125
128
  this.wallet,
126
129
  this.accounts[0],
127
130
  FullProverTest.TOKEN_NAME,
@@ -129,14 +132,15 @@ export class FullProverTest {
129
132
  FullProverTest.TOKEN_DECIMALS,
130
133
  )
131
134
  .send({ from: this.accounts[0] })
132
- .deployed();
135
+ .wait();
133
136
  this.logger.verbose(`Token deployed to ${asset.address}`);
134
137
 
135
- return { tokenContractAddress: asset.address };
138
+ return { tokenContractAddress: asset.address, tokenContractInstance: instance };
136
139
  },
137
- async ({ tokenContractAddress }) => {
140
+ async ({ tokenContractAddress, tokenContractInstance }) => {
138
141
  // Restore the token contract state.
139
- this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallet);
142
+ this.fakeProofsAsset = TokenContract.at(tokenContractAddress, this.wallet);
143
+ this.fakeProofsAssetInstance = tokenContractInstance;
140
144
  this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
141
145
 
142
146
  this.tokenSim = new TokenSimulator(
@@ -183,9 +187,7 @@ export class FullProverTest {
183
187
  this.acvmConfigCleanup = acvmConfig.cleanup;
184
188
  this.bbConfigCleanup = bbConfig.cleanup;
185
189
 
186
- if (!bbConfig?.bbWorkingDirectory || !bbConfig?.bbBinaryPath) {
187
- throw new Error(`Test must be run with BB native configuration`);
188
- }
190
+ await Barretenberg.initSingleton({ backend: BackendType.NativeUnixSocket });
189
191
 
190
192
  const verifier = await BBCircuitVerifier.new(bbConfig);
191
193
  this.circuitProofVerifier = new QueuedIVCVerifier(bbConfig, verifier);
@@ -212,23 +214,19 @@ export class FullProverTest {
212
214
  this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
213
215
  const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEAndGetWallet(
214
216
  this.aztecNode,
215
- {
216
- proverEnabled: this.realProofs,
217
- bbBinaryPath: bbConfig?.bbBinaryPath,
218
- bbWorkingDirectory: bbConfig?.bbWorkingDirectory,
219
- },
217
+ { proverEnabled: this.realProofs },
220
218
  undefined,
221
219
  true,
222
220
  );
223
221
  this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
224
- await provenWallet.registerContract(this.fakeProofsAsset);
222
+ await provenWallet.registerContract(this.fakeProofsAssetInstance, TokenContract.artifact);
225
223
 
226
224
  for (let i = 0; i < 2; i++) {
227
225
  await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
228
226
  await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
229
227
  }
230
228
 
231
- const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
229
+ const asset = TokenContract.at(this.fakeProofsAsset.address, provenWallet);
232
230
  this.provenComponents.push({
233
231
  wallet: provenWallet,
234
232
  teardown: provenTeardown,
@@ -245,7 +243,7 @@ export class FullProverTest {
245
243
  this.logger.verbose('Starting archiver for new prover node');
246
244
  const archiver = await createArchiver(
247
245
  { ...this.context.aztecNodeConfig, dataDirectory: undefined },
248
- { blobSinkClient },
246
+ { blobSinkClient, dateProvider: this.context.dateProvider },
249
247
  { blockUntilSync: true },
250
248
  );
251
249
 
@@ -321,6 +319,7 @@ export class FullProverTest {
321
319
  // clean up the full prover node
322
320
  await this.proverNode.stop();
323
321
 
322
+ await Barretenberg.destroySingleton();
324
323
  await this.bbConfigCleanup?.();
325
324
  await this.acvmConfigCleanup?.();
326
325
  }
@@ -22,8 +22,7 @@ export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_s
22
22
  export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
23
23
  export const NO_L1_TO_L2_MSG_ERROR =
24
24
  /No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
25
- export const STATIC_CALL_STATE_MODIFICATION_ERROR =
26
- /Static call cannot update the state, emit L2->L1 messages or generate logs.*/;
25
+ export const STATIC_CALL_STATE_MODIFICATION_ERROR = /Static call cannot update the state.*/;
27
26
  export const STATIC_CONTEXT_ASSERTION_ERROR = /Assertion failed: Function .* can only be called statically.*/;
28
27
 
29
28
  export const DEFAULT_BLOB_SINK_PORT = '5052';
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from '@aztec/aztec.js/log';
2
2
  import { parseBooleanEnv } from '@aztec/foundation/config';
3
- import { randomBytes } from '@aztec/foundation/crypto';
3
+ import { randomBytes } from '@aztec/foundation/crypto/random';
4
4
  import { tryRmDir } from '@aztec/foundation/fs';
5
5
 
6
6
  import { promises as fs } from 'fs';
@@ -1,5 +1,7 @@
1
- import { type ExtendedViemWalletClient, type L1ContractAddresses, RollupContract } from '@aztec/ethereum';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { RollupContract } from '@aztec/ethereum/contracts';
2
+ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
3
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
5
  import { tryJsonStringify } from '@aztec/foundation/json-rpc';
4
6
  import { InboxAbi } from '@aztec/l1-artifacts';
5
7
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -1,5 +1,6 @@
1
1
  import type { Logger } from '@aztec/aztec.js/log';
2
- import { type DeployL1ContractsArgs, type L1ContractsConfig, deployL1Contracts } from '@aztec/ethereum';
2
+ import type { L1ContractsConfig } from '@aztec/ethereum/config';
3
+ import { type DeployL1ContractsArgs, deployL1Contracts } from '@aztec/ethereum/deploy-l1-contracts';
3
4
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
4
5
  import { protocolContractsHash } from '@aztec/protocol-contracts';
5
6