@aztec/end-to-end 0.0.1-commit.24de95ac → 0.0.1-commit.5daedc8

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 (121) 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 +8 -1
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  5. package/dest/bench/client_flows/client_flows_benchmark.js +53 -30
  6. package/dest/bench/client_flows/config.d.ts +1 -1
  7. package/dest/bench/client_flows/data_extractor.d.ts +1 -1
  8. package/dest/bench/client_flows/data_extractor.js +5 -27
  9. package/dest/bench/utils.d.ts +2 -2
  10. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  12. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +2 -2
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +1 -1
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +4 -3
  16. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  18. package/dest/e2e_epochs/epochs_test.d.ts +1 -1
  19. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.js +6 -5
  21. package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
  22. package/dest/e2e_fees/bridging_race.notest.js +1 -1
  23. package/dest/e2e_fees/fees_test.d.ts +1 -1
  24. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  25. package/dest/e2e_fees/fees_test.js +12 -9
  26. package/dest/e2e_l1_publisher/write_json.d.ts +1 -1
  27. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  28. package/dest/e2e_l1_publisher/write_json.js +5 -4
  29. package/dest/e2e_multi_validator/utils.d.ts +1 -1
  30. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  31. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  32. package/dest/e2e_nested_contract/nested_contract_test.js +4 -3
  33. package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
  34. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  35. package/dest/e2e_p2p/inactivity_slash_test.js +6 -2
  36. package/dest/e2e_p2p/p2p_network.d.ts +214 -9
  37. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  38. package/dest/e2e_p2p/p2p_network.js +5 -3
  39. package/dest/e2e_p2p/shared.d.ts +5 -5
  40. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  41. package/dest/e2e_p2p/shared.js +6 -5
  42. package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
  43. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  44. package/dest/e2e_token_contract/token_contract_test.js +2 -2
  45. package/dest/fixtures/e2e_prover_test.d.ts +3 -1
  46. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  47. package/dest/fixtures/e2e_prover_test.js +18 -14
  48. package/dest/fixtures/fixtures.d.ts +1 -1
  49. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  50. package/dest/fixtures/get_bb_config.d.ts +1 -1
  51. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  52. package/dest/fixtures/index.d.ts +1 -1
  53. package/dest/fixtures/l1_to_l2_messaging.d.ts +1 -1
  54. package/dest/fixtures/logging.d.ts +1 -1
  55. package/dest/fixtures/setup_l1_contracts.d.ts +475 -4
  56. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  57. package/dest/fixtures/setup_p2p_test.d.ts +4 -4
  58. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  59. package/dest/fixtures/setup_p2p_test.js +15 -7
  60. package/dest/fixtures/snapshot_manager.d.ts +2 -2
  61. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  62. package/dest/fixtures/token_utils.d.ts +5 -2
  63. package/dest/fixtures/token_utils.d.ts.map +1 -1
  64. package/dest/fixtures/token_utils.js +7 -4
  65. package/dest/fixtures/utils.d.ts +449 -4
  66. package/dest/fixtures/utils.d.ts.map +1 -1
  67. package/dest/fixtures/utils.js +11 -12
  68. package/dest/fixtures/web3signer.d.ts +1 -1
  69. package/dest/fixtures/with_telemetry_utils.d.ts +1 -1
  70. package/dest/index.d.ts +1 -1
  71. package/dest/quality_of_service/alert_checker.d.ts +1 -1
  72. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  73. package/dest/shared/cross_chain_test_harness.d.ts +1 -12
  74. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  75. package/dest/shared/gas_portal_test_harness.d.ts +1 -11
  76. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  77. package/dest/shared/gas_portal_test_harness.js +1 -1
  78. package/dest/shared/index.d.ts +1 -1
  79. package/dest/shared/jest_setup.d.ts +1 -1
  80. package/dest/shared/submit-transactions.d.ts +1 -1
  81. package/dest/shared/submit-transactions.d.ts.map +1 -1
  82. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  83. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  84. package/dest/shared/uniswap_l1_l2.js +11 -11
  85. package/dest/simulators/index.d.ts +1 -1
  86. package/dest/simulators/lending_simulator.d.ts +1 -5
  87. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  88. package/dest/simulators/lending_simulator.js +4 -2
  89. package/dest/simulators/token_simulator.d.ts +1 -1
  90. package/dest/simulators/token_simulator.d.ts.map +1 -1
  91. package/dest/spartan/setup_test_wallets.d.ts +5 -3
  92. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  93. package/dest/spartan/setup_test_wallets.js +43 -9
  94. package/dest/spartan/utils.d.ts +20 -18
  95. package/dest/spartan/utils.d.ts.map +1 -1
  96. package/dest/spartan/utils.js +59 -26
  97. package/package.json +42 -40
  98. package/src/bench/client_flows/client_flows_benchmark.ts +75 -30
  99. package/src/bench/client_flows/data_extractor.ts +6 -28
  100. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +2 -2
  101. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +4 -3
  102. package/src/e2e_deploy_contract/deploy_test.ts +1 -1
  103. package/src/e2e_epochs/epochs_test.ts +6 -5
  104. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  105. package/src/e2e_fees/fees_test.ts +12 -9
  106. package/src/e2e_l1_publisher/write_json.ts +5 -4
  107. package/src/e2e_nested_contract/nested_contract_test.ts +4 -3
  108. package/src/e2e_p2p/inactivity_slash_test.ts +6 -2
  109. package/src/e2e_p2p/p2p_network.ts +7 -3
  110. package/src/e2e_p2p/shared.ts +8 -5
  111. package/src/e2e_token_contract/token_contract_test.ts +2 -2
  112. package/src/fixtures/e2e_prover_test.ts +15 -16
  113. package/src/fixtures/setup_p2p_test.ts +20 -6
  114. package/src/fixtures/token_utils.ts +4 -4
  115. package/src/fixtures/utils.ts +35 -16
  116. package/src/guides/up_quick_start.sh +1 -1
  117. package/src/shared/gas_portal_test_harness.ts +1 -1
  118. package/src/shared/uniswap_l1_l2.ts +11 -11
  119. package/src/simulators/lending_simulator.ts +4 -2
  120. package/src/spartan/setup_test_wallets.ts +47 -11
  121. package/src/spartan/utils.ts +64 -24
@@ -1,6 +1,4 @@
1
- import type { Logger } from '@aztec/aztec.js/log';
2
- import { BBNativePrivateKernelProver } from '@aztec/bb-prover/client/native';
3
- import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
1
+ import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
4
2
  import { createLogger, logger } from '@aztec/foundation/log';
5
3
  import { Timer } from '@aztec/foundation/timer';
6
4
  import { WASMSimulator } from '@aztec/simulator/client';
@@ -11,26 +9,7 @@ import { Decoder } from 'msgpackr';
11
9
  import { readFile, readdir, writeFile } from 'node:fs/promises';
12
10
  import { join } from 'node:path';
13
11
 
14
- import { type Log, type ProverType, ProxyLogger, generateBenchmark } from './benchmark.js';
15
-
16
- type NativeProverConfig = { bbBinaryPath?: string; bbWorkingDirectory?: string };
17
-
18
- async function createProver(config: NativeProverConfig = {}, log: Logger) {
19
- const simulator = new WASMSimulator();
20
- if (!config.bbBinaryPath || !config.bbWorkingDirectory) {
21
- return { prover: new BBWASMBundlePrivateKernelProver(simulator, 16, log), type: 'wasm' as ProverType };
22
- } else {
23
- const bbConfig = config as Required<NativeProverConfig>;
24
- return {
25
- prover: await BBNativePrivateKernelProver.new(
26
- { bbSkipCleanup: false, numConcurrentIVCVerifiers: 1, bbIVCConcurrency: 1, ...bbConfig },
27
- simulator,
28
- log,
29
- ),
30
- type: 'native' as ProverType,
31
- };
32
- }
33
- }
12
+ import { type Log, ProxyLogger, generateBenchmark } from './benchmark.js';
34
13
 
35
14
  async function main() {
36
15
  ProxyLogger.create();
@@ -41,10 +20,9 @@ async function main() {
41
20
  }
42
21
  const flows = await readdir(ivcFolder);
43
22
  logger.info(`Flows in ${ivcFolder}: \n${flows.map(flowName => `\t- ${flowName}`).join('\n')}`);
44
- const { prover, type: proverType } = await createProver(
45
- { bbBinaryPath: process.env.BB_BINARY_PATH, bbWorkingDirectory: process.env.BB_WORKING_DIRECTORY },
46
- proxyLogger.createLogger('bb:prover'),
47
- );
23
+ const simulator = new WASMSimulator();
24
+ const log = proxyLogger.createLogger('bb:prover');
25
+ const prover = new BBBundlePrivateKernelProver(simulator, log);
48
26
 
49
27
  const userLog = createLogger('chonk_flows:data_processor');
50
28
 
@@ -96,7 +74,7 @@ async function main() {
96
74
  if (!(profile.stats.timings as ProvingTimings).proving) {
97
75
  (profile.stats.timings as ProvingTimings).proving = provingTime;
98
76
  }
99
- const benchmark = generateBenchmark(flow, currentLogs, profile.stats, privateExecutionSteps, proverType, error);
77
+ const benchmark = generateBenchmark(flow, currentLogs, profile.stats, privateExecutionSteps, 'native', error);
100
78
  await writeFile(join(ivcFolder, flow, 'benchmark.json'), JSON.stringify(benchmark, null, 2));
101
79
  proxyLogger.flushLogs();
102
80
  }
@@ -130,7 +130,7 @@ export class BlacklistTokenContractTest {
130
130
  },
131
131
  async ({ tokenContractAddress, badAccountAddress }) => {
132
132
  // Restore the token contract state.
133
- this.asset = await TokenBlacklistContract.at(tokenContractAddress, this.wallet);
133
+ this.asset = TokenBlacklistContract.at(tokenContractAddress, this.wallet);
134
134
  this.logger.verbose(`Token contract address: ${this.asset.address}`);
135
135
 
136
136
  this.tokenSim = new TokenSimulator(
@@ -141,7 +141,7 @@ export class BlacklistTokenContractTest {
141
141
  [this.adminAddress, this.otherAddress, this.blacklistedAddress],
142
142
  );
143
143
 
144
- this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallet);
144
+ this.badAccount = InvalidAccountContract.at(badAccountAddress, this.wallet);
145
145
  this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
146
146
 
147
147
  expect(await this.asset.methods.get_roles(this.adminAddress).simulate({ from: this.adminAddress })).toEqual(
@@ -134,9 +134,9 @@ export class CrossChainMessagingTest {
134
134
 
135
135
  return this.crossChainTestHarness.toCrossChainContext();
136
136
  },
137
- async crossChainContext => {
138
- this.l2Token = await TokenContract.at(crossChainContext.l2Token, this.wallet);
139
- this.l2Bridge = await TokenBridgeContract.at(crossChainContext.l2Bridge, this.wallet);
137
+ crossChainContext => {
138
+ this.l2Token = TokenContract.at(crossChainContext.l2Token, this.wallet);
139
+ this.l2Bridge = TokenBridgeContract.at(crossChainContext.l2Bridge, this.wallet);
140
140
 
141
141
  // There is an issue with the reviver so we are getting strings sometimes. Working around it here.
142
142
  this.ethAccount = EthAddress.fromString(crossChainContext.ethAccount.toString());
@@ -172,6 +172,7 @@ export class CrossChainMessagingTest {
172
172
  this.l1Client = l1Client;
173
173
  this.inbox = inbox;
174
174
  this.outbox = outbox;
175
+ return Promise.resolve();
175
176
  },
176
177
  );
177
178
  }
@@ -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
  };
@@ -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,
@@ -293,7 +294,7 @@ export class EpochsTestContext {
293
294
  /** Waits until the given L2 block number is mined. */
294
295
  public async waitUntilL2BlockNumber(target: number, timeout = 60) {
295
296
  await retryUntil(
296
- () => Promise.resolve(target <= this.monitor.l2BlockNumber),
297
+ () => Promise.resolve(target <= this.monitor.checkpointNumber),
297
298
  `Wait until L2 block ${target}`,
298
299
  timeout,
299
300
  0.1,
@@ -303,17 +304,17 @@ export class EpochsTestContext {
303
304
  /** Waits until the given L2 block number is marked as proven. */
304
305
  public async waitUntilProvenL2BlockNumber(t: number, timeout = 60) {
305
306
  await retryUntil(
306
- () => Promise.resolve(t <= this.monitor.l2ProvenBlockNumber),
307
+ () => Promise.resolve(t <= this.monitor.provenCheckpointNumber),
307
308
  `Wait proven L2 block ${t}`,
308
309
  timeout,
309
310
  0.1,
310
311
  );
311
- return this.monitor.l2ProvenBlockNumber;
312
+ return this.monitor.provenCheckpointNumber;
312
313
  }
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}`, {
@@ -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
  };
@@ -136,7 +136,7 @@ export class FeesTest {
136
136
  }
137
137
 
138
138
  async getBlockRewards() {
139
- const blockReward = await this.rollupContract.getBlockReward();
139
+ const blockReward = await this.rollupContract.getCheckpointReward();
140
140
  const rewardConfig = await this.rollupContract.getRewardConfig();
141
141
 
142
142
  const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(
@@ -197,7 +197,7 @@ export class FeesTest {
197
197
  this.fpcAdmin = this.aliceAddress;
198
198
 
199
199
  const canonicalFeeJuice = await getCanonicalFeeJuice();
200
- this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
200
+ this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
201
201
  },
202
202
  );
203
203
  }
@@ -215,7 +215,7 @@ export class FeesTest {
215
215
  async (_data, context) => {
216
216
  this.context = context;
217
217
 
218
- this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
218
+ this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
219
219
 
220
220
  this.getGasBalanceFn = getBalancesFn(
221
221
  '⛽',
@@ -245,8 +245,8 @@ export class FeesTest {
245
245
  this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
246
246
  return { bananaCoinAddress: bananaCoin.address };
247
247
  },
248
- async ({ bananaCoinAddress }) => {
249
- this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.wallet);
248
+ ({ bananaCoinAddress }) => {
249
+ this.bananaCoin = BananaCoin.at(bananaCoinAddress, this.wallet);
250
250
  const logger = this.logger;
251
251
  this.getBananaPublicBalanceFn = getBalancesFn(
252
252
  '🍌.public',
@@ -260,6 +260,7 @@ export class FeesTest {
260
260
  this.aliceAddress,
261
261
  logger,
262
262
  );
263
+ return Promise.resolve();
263
264
  },
264
265
  );
265
266
  }
@@ -287,8 +288,8 @@ export class FeesTest {
287
288
  rollupAddress: context.deployL1ContractsValues.l1ContractAddresses.rollupAddress,
288
289
  };
289
290
  },
290
- async (data, context) => {
291
- const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.wallet);
291
+ (data, context) => {
292
+ const bananaFPC = FPCContract.at(data.bananaFPCAddress, this.wallet);
292
293
  this.bananaFPC = bananaFPC;
293
294
 
294
295
  this.getCoinbaseBalance = async () => {
@@ -328,6 +329,7 @@ export class FeesTest {
328
329
  const mana = block!.header.totalManaUsed.toBigInt();
329
330
  return mulDiv(mana * proverCost, price, 10n ** 9n);
330
331
  };
332
+ return Promise.resolve();
331
333
  },
332
334
  );
333
335
  }
@@ -346,8 +348,9 @@ export class FeesTest {
346
348
  sponsoredFPCAddress: sponsoredFPC.address,
347
349
  };
348
350
  },
349
- async data => {
350
- this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
351
+ data => {
352
+ this.sponsoredFPC = SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
353
+ return Promise.resolve();
351
354
  },
352
355
  );
353
356
  }
@@ -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),
@@ -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
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.getLagInEpochs()) + 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.
@@ -326,11 +329,12 @@ export class P2PNetworkTest {
326
329
  .deployed();
327
330
  return { contractAddress: spamContract.address };
328
331
  },
329
- async ({ contractAddress }) => {
332
+ ({ contractAddress }) => {
330
333
  if (!this.wallet) {
331
334
  throw new Error('Call snapshot t.setupAccount before deploying account contract');
332
335
  }
333
- this.spamContract = await SpamContract.at(contractAddress, this.wallet);
336
+ this.spamContract = SpamContract.at(contractAddress, this.wallet);
337
+ return Promise.resolve();
334
338
  },
335
339
  );
336
340
  }
@@ -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';
@@ -80,7 +81,7 @@ export async function prepareTransactions(
80
81
  salt: Fr.random(),
81
82
  });
82
83
  await wallet.registerContract(testContractInstance, TestContractArtifact);
83
- const contract = await TestContract.at(testContractInstance.address, wallet);
84
+ const contract = TestContract.at(testContractInstance.address, wallet);
84
85
 
85
86
  return timesAsync(numTxs, async () => {
86
87
  const tx = await proveInteraction(wallet, contract.methods.emit_nullifier(Fr.random()), {
@@ -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.getLagInEpochs()) + 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.getLagInEpochs()) + 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();
@@ -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,6 +10,7 @@ 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
16
  import type { DeployL1ContractsReturnType } from '@aztec/ethereum';
@@ -18,6 +19,7 @@ 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
  }
@@ -2,6 +2,7 @@
2
2
  * Test fixtures and utilities to set up and run a test using multiple validators
3
3
  */
4
4
  import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
5
+ import { range } from '@aztec/foundation/array';
5
6
  import { SecretValue } from '@aztec/foundation/config';
6
7
  import { addLogNameHandler, removeLogNameHandler } from '@aztec/foundation/log';
7
8
  import { bufferToHex } from '@aztec/foundation/string';
@@ -40,6 +41,7 @@ export async function createNodes(
40
41
  dataDirectory?: string,
41
42
  metricsPort?: number,
42
43
  indexOffset = 0,
44
+ validatorsPerNode = 1,
43
45
  ): Promise<AztecNodeService[]> {
44
46
  const nodePromises: Promise<AztecNodeService>[] = [];
45
47
  const loggerIdStorage = new AsyncLocalStorage<string>();
@@ -52,13 +54,18 @@ export async function createNodes(
52
54
  // We run on ports from the bootnode upwards
53
55
  const port = bootNodePort + 1 + index;
54
56
 
57
+ // Determine validator indices for this node
58
+ const validatorIndices = validatorsPerNode === 1 ? index : range(validatorsPerNode, validatorsPerNode * index);
59
+
60
+ // Assign data directory
55
61
  const dataDir = dataDirectory ? `${dataDirectory}-${index}` : undefined;
62
+
56
63
  const nodePromise = createNode(
57
64
  config,
58
65
  dateProvider,
59
66
  port,
60
67
  bootstrapNodeEnr,
61
- index,
68
+ validatorIndices,
62
69
  prefilledPublicData,
63
70
  dataDir,
64
71
  metricsPort,
@@ -84,7 +91,7 @@ export async function createNode(
84
91
  dateProvider: DateProvider,
85
92
  tcpPort: number,
86
93
  bootstrapNode: string | undefined,
87
- addressIndex: number,
94
+ addressIndex: number | number[],
88
95
  prefilledPublicData?: PublicDataTreeLeaf[],
89
96
  dataDirectory?: string,
90
97
  metricsPort?: number,
@@ -188,16 +195,23 @@ export async function createValidatorConfig(
188
195
  config: AztecNodeConfig,
189
196
  bootstrapNodeEnr?: string,
190
197
  port?: number,
191
- addressIndex: number = 1,
198
+ addressIndex: number | number[] = 1,
192
199
  dataDirectory?: string,
193
200
  ) {
194
- const attesterPrivateKey = bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!);
201
+ const addressIndices = Array.isArray(addressIndex) ? addressIndex : [addressIndex];
202
+ if (addressIndices.length === 0) {
203
+ throw new Error('At least one address index must be provided to create a validator config');
204
+ }
205
+
206
+ const attesterPrivateKeys = addressIndices.map(index =>
207
+ bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + index)!),
208
+ );
195
209
  const p2pConfig = await createP2PConfig(config, bootstrapNodeEnr, port, dataDirectory);
196
210
  const nodeConfig: AztecNodeConfig = {
197
211
  ...config,
198
212
  ...p2pConfig,
199
- validatorPrivateKeys: new SecretValue([attesterPrivateKey]),
200
- publisherPrivateKeys: [new SecretValue(attesterPrivateKey)],
213
+ validatorPrivateKeys: new SecretValue(attesterPrivateKeys),
214
+ publisherPrivateKeys: [new SecretValue(attesterPrivateKeys[0])],
201
215
  };
202
216
 
203
217
  return nodeConfig;
@@ -6,9 +6,9 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
6
6
 
7
7
  export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
8
8
  logger.info(`Deploying Token contract...`);
9
- const contract = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
9
+ const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
10
10
  .send({ from: admin })
11
- .deployed();
11
+ .wait();
12
12
 
13
13
  if (initialAdminBalance > 0n) {
14
14
  await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
@@ -16,7 +16,7 @@ export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAd
16
16
 
17
17
  logger.info('L2 contract deployed');
18
18
 
19
- return contract;
19
+ return { contract, instance };
20
20
  }
21
21
 
22
22
  export async function mintTokensToPrivate(
@@ -36,7 +36,7 @@ export async function expectTokenBalance(
36
36
  logger: Logger,
37
37
  ) {
38
38
  // Then check the balance
39
- const contractWithWallet = await TokenContract.at(token.address, wallet);
39
+ const contractWithWallet = TokenContract.at(token.address, wallet);
40
40
  const balance = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
41
41
  logger.info(`Account ${owner} balance: ${balance}`);
42
42
  expect(balance).toBe(expectedBalance);