@aztec/end-to-end 0.0.1-commit.cb6bed7c2 → 0.0.1-commit.cbf2c2d5d

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 (55) hide show
  1. package/dest/e2e_epochs/epochs_test.d.ts +3 -1
  2. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  3. package/dest/e2e_epochs/epochs_test.js +5 -2
  4. package/dest/e2e_p2p/reqresp/utils.d.ts +1 -1
  5. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
  6. package/dest/e2e_p2p/reqresp/utils.js +15 -2
  7. package/dest/e2e_p2p/shared.d.ts +12 -6
  8. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  9. package/dest/e2e_p2p/shared.js +17 -9
  10. package/dest/fixtures/e2e_prover_test.d.ts +4 -3
  11. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  12. package/dest/fixtures/e2e_prover_test.js +3 -5
  13. package/dest/fixtures/get_bb_config.d.ts +1 -1
  14. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  15. package/dest/fixtures/get_bb_config.js +5 -5
  16. package/dest/fixtures/setup.d.ts +6 -1
  17. package/dest/fixtures/setup.d.ts.map +1 -1
  18. package/dest/fixtures/setup.js +10 -7
  19. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  20. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  21. package/dest/shared/uniswap_l1_l2.js +9 -12
  22. package/dest/simulators/lending_simulator.d.ts +1 -1
  23. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  24. package/dest/simulators/lending_simulator.js +2 -2
  25. package/dest/simulators/token_simulator.js +1 -1
  26. package/dest/spartan/setup_test_wallets.d.ts +4 -2
  27. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  28. package/dest/spartan/setup_test_wallets.js +19 -7
  29. package/dest/spartan/utils/config.d.ts +4 -1
  30. package/dest/spartan/utils/config.d.ts.map +1 -1
  31. package/dest/spartan/utils/config.js +1 -0
  32. package/dest/spartan/utils/index.d.ts +2 -1
  33. package/dest/spartan/utils/index.d.ts.map +1 -1
  34. package/dest/spartan/utils/index.js +2 -0
  35. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  36. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  37. package/dest/spartan/utils/pod_logs.js +74 -0
  38. package/dest/test-wallet/test_wallet.d.ts +10 -17
  39. package/dest/test-wallet/test_wallet.d.ts.map +1 -1
  40. package/dest/test-wallet/test_wallet.js +31 -31
  41. package/package.json +39 -40
  42. package/src/e2e_epochs/epochs_test.ts +14 -2
  43. package/src/e2e_p2p/reqresp/utils.ts +23 -2
  44. package/src/e2e_p2p/shared.ts +20 -10
  45. package/src/fixtures/e2e_prover_test.ts +5 -11
  46. package/src/fixtures/get_bb_config.ts +7 -6
  47. package/src/fixtures/setup.ts +15 -7
  48. package/src/shared/uniswap_l1_l2.ts +29 -24
  49. package/src/simulators/lending_simulator.ts +4 -2
  50. package/src/simulators/token_simulator.ts +1 -1
  51. package/src/spartan/setup_test_wallets.ts +44 -6
  52. package/src/spartan/utils/config.ts +1 -0
  53. package/src/spartan/utils/index.ts +3 -0
  54. package/src/spartan/utils/pod_logs.ts +99 -0
  55. package/src/test-wallet/test_wallet.ts +29 -41
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/end-to-end",
3
- "version": "0.0.1-commit.cb6bed7c2",
3
+ "version": "0.0.1-commit.cbf2c2d5d",
4
4
  "type": "module",
5
5
  "exports": "./dest/index.js",
6
6
  "inherits": [
@@ -26,45 +26,44 @@
26
26
  "formatting": "run -T prettier --check ./src && run -T eslint ./src"
27
27
  },
28
28
  "dependencies": {
29
- "@aztec/accounts": "0.0.1-commit.cb6bed7c2",
30
- "@aztec/archiver": "0.0.1-commit.cb6bed7c2",
31
- "@aztec/aztec": "0.0.1-commit.cb6bed7c2",
32
- "@aztec/aztec-node": "0.0.1-commit.cb6bed7c2",
33
- "@aztec/aztec.js": "0.0.1-commit.cb6bed7c2",
34
- "@aztec/bb-prover": "0.0.1-commit.cb6bed7c2",
35
- "@aztec/bb.js": "0.0.1-commit.cb6bed7c2",
36
- "@aztec/blob-client": "0.0.1-commit.cb6bed7c2",
37
- "@aztec/blob-lib": "0.0.1-commit.cb6bed7c2",
38
- "@aztec/bot": "0.0.1-commit.cb6bed7c2",
39
- "@aztec/cli": "0.0.1-commit.cb6bed7c2",
40
- "@aztec/constants": "0.0.1-commit.cb6bed7c2",
41
- "@aztec/entrypoints": "0.0.1-commit.cb6bed7c2",
42
- "@aztec/epoch-cache": "0.0.1-commit.cb6bed7c2",
43
- "@aztec/ethereum": "0.0.1-commit.cb6bed7c2",
44
- "@aztec/foundation": "0.0.1-commit.cb6bed7c2",
45
- "@aztec/kv-store": "0.0.1-commit.cb6bed7c2",
46
- "@aztec/l1-artifacts": "0.0.1-commit.cb6bed7c2",
47
- "@aztec/merkle-tree": "0.0.1-commit.cb6bed7c2",
48
- "@aztec/node-keystore": "0.0.1-commit.cb6bed7c2",
49
- "@aztec/noir-contracts.js": "0.0.1-commit.cb6bed7c2",
50
- "@aztec/noir-noirc_abi": "0.0.1-commit.cb6bed7c2",
51
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.cb6bed7c2",
52
- "@aztec/noir-test-contracts.js": "0.0.1-commit.cb6bed7c2",
53
- "@aztec/p2p": "0.0.1-commit.cb6bed7c2",
54
- "@aztec/protocol-contracts": "0.0.1-commit.cb6bed7c2",
55
- "@aztec/prover-client": "0.0.1-commit.cb6bed7c2",
56
- "@aztec/prover-node": "0.0.1-commit.cb6bed7c2",
57
- "@aztec/pxe": "0.0.1-commit.cb6bed7c2",
58
- "@aztec/sequencer-client": "0.0.1-commit.cb6bed7c2",
59
- "@aztec/simulator": "0.0.1-commit.cb6bed7c2",
60
- "@aztec/slasher": "0.0.1-commit.cb6bed7c2",
61
- "@aztec/stdlib": "0.0.1-commit.cb6bed7c2",
62
- "@aztec/telemetry-client": "0.0.1-commit.cb6bed7c2",
63
- "@aztec/validator-client": "0.0.1-commit.cb6bed7c2",
64
- "@aztec/validator-ha-signer": "0.0.1-commit.cb6bed7c2",
65
- "@aztec/wallet-sdk": "0.0.1-commit.cb6bed7c2",
66
- "@aztec/wallets": "0.0.1-commit.cb6bed7c2",
67
- "@aztec/world-state": "0.0.1-commit.cb6bed7c2",
29
+ "@aztec/accounts": "0.0.1-commit.cbf2c2d5d",
30
+ "@aztec/archiver": "0.0.1-commit.cbf2c2d5d",
31
+ "@aztec/aztec": "0.0.1-commit.cbf2c2d5d",
32
+ "@aztec/aztec-node": "0.0.1-commit.cbf2c2d5d",
33
+ "@aztec/aztec.js": "0.0.1-commit.cbf2c2d5d",
34
+ "@aztec/bb-prover": "0.0.1-commit.cbf2c2d5d",
35
+ "@aztec/bb.js": "0.0.1-commit.cbf2c2d5d",
36
+ "@aztec/blob-client": "0.0.1-commit.cbf2c2d5d",
37
+ "@aztec/blob-lib": "0.0.1-commit.cbf2c2d5d",
38
+ "@aztec/bot": "0.0.1-commit.cbf2c2d5d",
39
+ "@aztec/cli": "0.0.1-commit.cbf2c2d5d",
40
+ "@aztec/constants": "0.0.1-commit.cbf2c2d5d",
41
+ "@aztec/entrypoints": "0.0.1-commit.cbf2c2d5d",
42
+ "@aztec/epoch-cache": "0.0.1-commit.cbf2c2d5d",
43
+ "@aztec/ethereum": "0.0.1-commit.cbf2c2d5d",
44
+ "@aztec/foundation": "0.0.1-commit.cbf2c2d5d",
45
+ "@aztec/kv-store": "0.0.1-commit.cbf2c2d5d",
46
+ "@aztec/l1-artifacts": "0.0.1-commit.cbf2c2d5d",
47
+ "@aztec/node-keystore": "0.0.1-commit.cbf2c2d5d",
48
+ "@aztec/noir-contracts.js": "0.0.1-commit.cbf2c2d5d",
49
+ "@aztec/noir-noirc_abi": "0.0.1-commit.cbf2c2d5d",
50
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.cbf2c2d5d",
51
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.cbf2c2d5d",
52
+ "@aztec/p2p": "0.0.1-commit.cbf2c2d5d",
53
+ "@aztec/protocol-contracts": "0.0.1-commit.cbf2c2d5d",
54
+ "@aztec/prover-client": "0.0.1-commit.cbf2c2d5d",
55
+ "@aztec/prover-node": "0.0.1-commit.cbf2c2d5d",
56
+ "@aztec/pxe": "0.0.1-commit.cbf2c2d5d",
57
+ "@aztec/sequencer-client": "0.0.1-commit.cbf2c2d5d",
58
+ "@aztec/simulator": "0.0.1-commit.cbf2c2d5d",
59
+ "@aztec/slasher": "0.0.1-commit.cbf2c2d5d",
60
+ "@aztec/stdlib": "0.0.1-commit.cbf2c2d5d",
61
+ "@aztec/telemetry-client": "0.0.1-commit.cbf2c2d5d",
62
+ "@aztec/validator-client": "0.0.1-commit.cbf2c2d5d",
63
+ "@aztec/validator-ha-signer": "0.0.1-commit.cbf2c2d5d",
64
+ "@aztec/wallet-sdk": "0.0.1-commit.cbf2c2d5d",
65
+ "@aztec/wallets": "0.0.1-commit.cbf2c2d5d",
66
+ "@aztec/world-state": "0.0.1-commit.cbf2c2d5d",
68
67
  "@iarna/toml": "^2.2.5",
69
68
  "@jest/globals": "^30.0.0",
70
69
  "@noble/curves": "=1.0.0",
@@ -28,6 +28,7 @@ import { type SequencerClient, type SequencerEvents, SequencerState } from '@azt
28
28
  import { type BlockParameter, EthAddress } from '@aztec/stdlib/block';
29
29
  import { type L1RollupConstants, getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
30
30
  import { tryStop } from '@aztec/stdlib/interfaces/server';
31
+ import type { SlashingProtectionDatabase } from '@aztec/validator-ha-signer/types';
31
32
 
32
33
  import { join } from 'path';
33
34
  import type { Hex } from 'viem';
@@ -181,6 +182,7 @@ export class EpochsTestContext {
181
182
  ethereumSlotDuration,
182
183
  proofSubmissionEpochs: Number(await this.rollup.getProofSubmissionEpochs()),
183
184
  targetCommitteeSize: await this.rollup.getTargetCommitteeSize(),
185
+ rollupManaLimit: Number(await this.rollup.getManaLimit()),
184
186
  };
185
187
 
186
188
  this.logger.info(
@@ -237,13 +239,21 @@ export class EpochsTestContext {
237
239
 
238
240
  public createValidatorNode(
239
241
  privateKeys: `0x${string}`[],
240
- opts: Partial<AztecNodeConfig> & { dontStartSequencer?: boolean } = {},
242
+ opts: Partial<AztecNodeConfig> & {
243
+ dontStartSequencer?: boolean;
244
+ slashingProtectionDb?: SlashingProtectionDatabase;
245
+ } = {},
241
246
  ) {
242
247
  this.logger.warn('Creating and syncing a validator node...');
243
248
  return this.createNode({ ...opts, disableValidator: false, validatorPrivateKeys: new SecretValue(privateKeys) });
244
249
  }
245
250
 
246
- private async createNode(opts: Partial<AztecNodeConfig> & { dontStartSequencer?: boolean } = {}) {
251
+ private async createNode(
252
+ opts: Partial<AztecNodeConfig> & {
253
+ dontStartSequencer?: boolean;
254
+ slashingProtectionDb?: SlashingProtectionDatabase;
255
+ } = {},
256
+ ) {
247
257
  const nodeIndex = this.nodes.length + 1;
248
258
  const actorPrefix = opts.disableValidator ? 'node' : 'validator';
249
259
  const { mockGossipSubNetwork } = this.context;
@@ -256,6 +266,7 @@ export class EpochsTestContext {
256
266
  ...resolvedConfig,
257
267
  dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
258
268
  validatorPrivateKeys: opts.validatorPrivateKeys ?? new SecretValue([]),
269
+ nodeId: resolvedConfig.nodeId || `${actorPrefix}-${nodeIndex}`,
259
270
  p2pEnabled,
260
271
  p2pIp,
261
272
  },
@@ -264,6 +275,7 @@ export class EpochsTestContext {
264
275
  p2pClientDeps: {
265
276
  p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined,
266
277
  },
278
+ slashingProtectionDb: opts.slashingProtectionDb,
267
279
  },
268
280
  {
269
281
  prefilledPublicData: this.context.prefilledPublicData,
@@ -149,6 +149,13 @@ export async function runReqrespTxTest(params: {
149
149
  const submittedTxs = await Promise.all(
150
150
  txBatches.map(async (batch, batchIndex) => {
151
151
  const proposerNode = nodes[proposerIndexes[batchIndex]];
152
+ for (const tx of batch) {
153
+ t.logger.info(`Tx ${tx.getTxHash().toString()} base64: ${tx.toBuffer().toString('base64')}`);
154
+ }
155
+ const txHashes = batch.map(tx => tx.getTxHash().toString());
156
+ t.logger.info(
157
+ `Sending batch ${batchIndex} to proposer ${getNodePort(proposerIndexes[batchIndex])}: ${txHashes.join(', ')}`,
158
+ );
152
159
  await Promise.all(
153
160
  batch.map(async tx => {
154
161
  try {
@@ -163,6 +170,12 @@ export async function runReqrespTxTest(params: {
163
170
  }),
164
171
  );
165
172
 
173
+ // Log pool state per node after sending
174
+ for (let i = 0; i < NUM_VALIDATORS; i++) {
175
+ const count = await nodes[i].getPendingTxCount();
176
+ t.logger.info(`Node ${getNodePort(i)} pool has ${count} pending txs`);
177
+ }
178
+
166
179
  t.logger.info('Waiting for all transactions to be mined');
167
180
  await Promise.all(
168
181
  submittedTxs.flatMap((batch, batchIndex) =>
@@ -178,8 +191,16 @@ export async function runReqrespTxTest(params: {
178
191
 
179
192
  // Assert that multiple blocks were built for at least one slot
180
193
  t.logger.info('Verifying multiple blocks for at least one checkpoint');
181
- const checkpoints = await nodes[0].getCheckpoints(CheckpointNumber(1), 50);
182
- expect(checkpoints.length).toBeGreaterThan(0);
194
+ // Wait for L1 checkpoint sync, which may lag behind P2P block propagation.
195
+ const checkpoints = await retryUntil(
196
+ async () => {
197
+ const cps = await nodes[0].getCheckpoints(CheckpointNumber(1), 50);
198
+ return cps.length > 0 && cps.some(cp => cp.checkpoint.blocks.length >= 2) ? cps : undefined;
199
+ },
200
+ 'waiting for multi-block checkpoint to sync from L1',
201
+ 30,
202
+ 1,
203
+ );
183
204
 
184
205
  let mbpsFound = false;
185
206
  let expectedBlockNumber = checkpoints[0].checkpoint.blocks[0].number;
@@ -152,11 +152,14 @@ export async function awaitCommitteeExists({
152
152
  }
153
153
 
154
154
  /**
155
- * Advance epochs until we find one where the target proposer is selected for at least one slot.
156
- * With N validators and M slots per epoch, a specific proposer may not be selected in any given epoch.
157
- * For example, with 4 validators and 2 slots/epoch, there is about a 44% chance per epoch.
155
+ * Advance epochs until we find one where the target proposer is selected for at least one slot,
156
+ * then stop one epoch before it. This leaves time for the caller to start sequencers before
157
+ * warping to the target epoch, avoiding the race where the target epoch passes before sequencers
158
+ * are ready.
159
+ *
160
+ * Returns the target epoch number so the caller can warp to it after starting sequencers.
158
161
  */
159
- export async function awaitEpochWithProposer({
162
+ export async function advanceToEpochBeforeProposer({
160
163
  epochCache,
161
164
  cheatCodes,
162
165
  targetProposer,
@@ -168,25 +171,32 @@ export async function awaitEpochWithProposer({
168
171
  targetProposer: EthAddress;
169
172
  logger: Logger;
170
173
  maxAttempts?: number;
171
- }): Promise<void> {
174
+ }): Promise<{ targetEpoch: EpochNumber }> {
172
175
  const { epochDuration } = await cheatCodes.getConfig();
173
176
 
174
177
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
175
178
  const currentEpoch = await cheatCodes.getEpoch();
176
- const startSlot = Number(currentEpoch) * Number(epochDuration);
179
+ // Check the NEXT epoch's slots so we stay one epoch before the target,
180
+ // giving the caller time to start sequencers before the target epoch arrives.
181
+ const nextEpoch = Number(currentEpoch) + 1;
182
+ const startSlot = nextEpoch * Number(epochDuration);
177
183
  const endSlot = startSlot + Number(epochDuration);
178
184
 
179
- logger.info(`Checking epoch ${currentEpoch} (slots ${startSlot}-${endSlot - 1}) for proposer ${targetProposer}`);
185
+ logger.info(
186
+ `Checking next epoch ${nextEpoch} (slots ${startSlot}-${endSlot - 1}) for proposer ${targetProposer} (current epoch: ${currentEpoch})`,
187
+ );
180
188
 
181
189
  for (let s = startSlot; s < endSlot; s++) {
182
190
  const proposer = await epochCache.getProposerAttesterAddressInSlot(SlotNumber(s));
183
191
  if (proposer && proposer.equals(targetProposer)) {
184
- logger.warn(`Found target proposer ${targetProposer} in slot ${s} of epoch ${currentEpoch}`);
185
- return;
192
+ logger.warn(
193
+ `Found target proposer ${targetProposer} in slot ${s} of epoch ${nextEpoch}. Staying at epoch ${currentEpoch} to allow sequencer startup.`,
194
+ );
195
+ return { targetEpoch: EpochNumber(nextEpoch) };
186
196
  }
187
197
  }
188
198
 
189
- logger.info(`Target proposer not found in epoch ${currentEpoch}, advancing to next epoch`);
199
+ logger.info(`Target proposer not found in epoch ${nextEpoch}, advancing to next epoch`);
190
200
  await cheatCodes.advanceToNextEpoch();
191
201
  }
192
202
 
@@ -4,12 +4,7 @@ import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
4
4
  import { type Logger, createLogger } from '@aztec/aztec.js/log';
5
5
  import type { AztecNode } from '@aztec/aztec.js/node';
6
6
  import { CheatCodes } from '@aztec/aztec/testing';
7
- import {
8
- BBCircuitVerifier,
9
- type ClientProtocolCircuitVerifier,
10
- QueuedIVCVerifier,
11
- TestCircuitVerifier,
12
- } from '@aztec/bb-prover';
7
+ import type { ClientProtocolCircuitVerifier } from '@aztec/bb-prover';
13
8
  import { BackendType, Barretenberg } from '@aztec/bb.js';
14
9
  import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
15
10
  import { Buffer32 } from '@aztec/foundation/buffer';
@@ -68,7 +63,10 @@ export class FullProverTest {
68
63
  private provenComponents: ProvenSetup[] = [];
69
64
  private bbConfigCleanup?: () => Promise<void>;
70
65
  private acvmConfigCleanup?: () => Promise<void>;
71
- circuitProofVerifier?: ClientProtocolCircuitVerifier;
66
+ /** Returns the proof verifier from the prover node (for test assertions). */
67
+ get circuitProofVerifier(): ClientProtocolCircuitVerifier | undefined {
68
+ return this.proverAztecNode?.getProofVerifier();
69
+ }
72
70
  provenAsset!: TokenContract;
73
71
  context!: EndToEndContext;
74
72
  private proverAztecNode!: AztecNodeService;
@@ -170,9 +168,6 @@ export class FullProverTest {
170
168
 
171
169
  await Barretenberg.initSingleton({ backend: BackendType.NativeUnixSocket });
172
170
 
173
- const verifier = await BBCircuitVerifier.new(bbConfig);
174
- this.circuitProofVerifier = new QueuedIVCVerifier(bbConfig, verifier);
175
-
176
171
  this.logger.debug(`Configuring the node for real proofs...`);
177
172
  await this.aztecNodeAdmin.setConfig({
178
173
  realProofs: true,
@@ -180,7 +175,6 @@ export class FullProverTest {
180
175
  });
181
176
  } else {
182
177
  this.logger.debug(`Configuring the node min txs per block ${this.minNumberOfTxsPerBlock}...`);
183
- this.circuitProofVerifier = new TestCircuitVerifier();
184
178
  await this.aztecNodeAdmin.setConfig({
185
179
  minTxsPerBlock: this.minNumberOfTxsPerBlock,
186
180
  });
@@ -13,8 +13,10 @@ const {
13
13
  BB_SKIP_CLEANUP = '',
14
14
  TEMP_DIR = tmpdir(),
15
15
  BB_WORKING_DIRECTORY = '',
16
- BB_NUM_IVC_VERIFIERS = '1',
16
+ BB_NUM_IVC_VERIFIERS = '8',
17
17
  BB_IVC_CONCURRENCY = '1',
18
+ BB_CHONK_VERIFY_MAX_BATCH = '16',
19
+ BB_CHONK_VERIFY_BATCH_CONCURRENCY = '6',
18
20
  } = process.env;
19
21
 
20
22
  export const getBBConfig = async (
@@ -41,16 +43,15 @@ export const getBBConfig = async (
41
43
  const bbSkipCleanup = ['1', 'true'].includes(BB_SKIP_CLEANUP);
42
44
  const cleanup = bbSkipCleanup ? () => Promise.resolve() : () => tryRmDir(directoryToCleanup);
43
45
 
44
- const numIvcVerifiers = Number(BB_NUM_IVC_VERIFIERS);
45
- const ivcConcurrency = Number(BB_IVC_CONCURRENCY);
46
-
47
46
  return {
48
47
  bbSkipCleanup,
49
48
  bbBinaryPath,
50
49
  bbWorkingDirectory,
51
50
  cleanup,
52
- numConcurrentIVCVerifiers: numIvcVerifiers,
53
- bbIVCConcurrency: ivcConcurrency,
51
+ numConcurrentIVCVerifiers: Number(BB_NUM_IVC_VERIFIERS),
52
+ bbIVCConcurrency: Number(BB_IVC_CONCURRENCY),
53
+ bbChonkVerifyMaxBatch: Number(BB_CHONK_VERIFY_MAX_BATCH),
54
+ bbChonkVerifyConcurrency: Number(BB_CHONK_VERIFY_BATCH_CONCURRENCY),
54
55
  };
55
56
  } catch (err) {
56
57
  logger.error(`Native BB not available, error: ${err}`);
@@ -185,6 +185,11 @@ export type SetupOptions = {
185
185
  anvilAccounts?: number;
186
186
  /** Port to start anvil (defaults to 8545) */
187
187
  anvilPort?: number;
188
+ /**
189
+ * Number of slots per epoch for Anvil's finality simulation.
190
+ * Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
191
+ */
192
+ anvilSlotsInAnEpoch?: number;
188
193
  /** Key to use for publishing L1 contracts */
189
194
  l1PublisherKey?: SecretValue<`0x${string}`>;
190
195
  /** ZkPassport configuration (domain, scope, mock verifier) */
@@ -297,6 +302,8 @@ export async function setup(
297
302
  config.dataDirectory = directoryToCleanup;
298
303
  }
299
304
 
305
+ const dateProvider = new TestDateProvider();
306
+
300
307
  if (!config.l1RpcUrls?.length) {
301
308
  if (!isAnvilTestChain(chain.id)) {
302
309
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
@@ -305,6 +312,8 @@ export async function setup(
305
312
  l1BlockTime: opts.ethereumSlotDuration,
306
313
  accounts: opts.anvilAccounts,
307
314
  port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
315
+ slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
316
+ dateProvider,
308
317
  });
309
318
  anvil = res.anvil;
310
319
  config.l1RpcUrls = [res.rpcUrl];
@@ -316,8 +325,6 @@ export async function setup(
316
325
  logger.info(`Logging metrics to ${filename}`);
317
326
  setupMetricsLogger(filename);
318
327
  }
319
-
320
- const dateProvider = new TestDateProvider();
321
328
  const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
322
329
 
323
330
  if (opts.stateLoad) {
@@ -413,11 +420,12 @@ export async function setup(
413
420
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
414
421
  }
415
422
 
416
- // Always sync dateProvider to L1 time after deploying L1 contracts, regardless of mining mode.
417
- // In compose mode, L1 time may have drifted ahead of system time due to the local-network watcher
418
- // warping time forward on each filled slot. Without this sync, the sequencer computes the wrong
419
- // slot from its dateProvider and cannot propose blocks.
420
- dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
423
+ // In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
424
+ // ahead of system time due to the local-network watcher warping time forward on each filled slot.
425
+ // When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
426
+ if (!anvil) {
427
+ dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
428
+ }
421
429
 
422
430
  if (opts.l2StartTime) {
423
431
  await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
@@ -252,8 +252,12 @@ export const uniswapL1L2TestSuite = (
252
252
  await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
253
253
 
254
254
  // Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
255
- const block = await aztecNode.getBlock(l2UniswapInteractionReceipt.blockNumber!);
256
- const epoch = await rollup.getEpochNumberForCheckpoint(block!.checkpointNumber);
255
+ const swapResult = (await computeL2ToL1MembershipWitness(
256
+ aztecNode,
257
+ swapPrivateLeaf,
258
+ l2UniswapInteractionReceipt.txHash,
259
+ ))!;
260
+ const { epochNumber: epoch } = swapResult;
257
261
  await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
258
262
  await waitForProven(aztecNode, l2UniswapInteractionReceipt, { provenTimeout: 300 });
259
263
 
@@ -262,14 +266,17 @@ export const uniswapL1L2TestSuite = (
262
266
  const daiL1BalanceOfPortalBeforeSwap = await daiCrossChainHarness.getL1BalanceOf(
263
267
  daiCrossChainHarness.tokenPortalAddress,
264
268
  );
265
- const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPrivateLeaf);
266
- const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
269
+ const withdrawResult = (await computeL2ToL1MembershipWitness(
270
+ aztecNode,
271
+ withdrawLeaf,
272
+ l2UniswapInteractionReceipt.txHash,
273
+ ))!;
267
274
 
268
- const swapPrivateL2MessageIndex = swapResult!.leafIndex;
269
- const swapPrivateSiblingPath = swapResult!.siblingPath;
275
+ const swapPrivateL2MessageIndex = swapResult.leafIndex;
276
+ const swapPrivateSiblingPath = swapResult.siblingPath;
270
277
 
271
- const withdrawL2MessageIndex = withdrawResult!.leafIndex;
272
- const withdrawSiblingPath = withdrawResult!.siblingPath;
278
+ const withdrawL2MessageIndex = withdrawResult.leafIndex;
279
+ const withdrawSiblingPath = withdrawResult.siblingPath;
273
280
 
274
281
  const withdrawMessageMetadata = {
275
282
  _epoch: BigInt(epoch),
@@ -840,16 +847,15 @@ export const uniswapL1L2TestSuite = (
840
847
  chainId: new Fr(l1Client.chain.id),
841
848
  });
842
849
 
843
- const block = await aztecNode.getBlock(withdrawReceipt.blockNumber!);
844
- const epoch = await rollup.getEpochNumberForCheckpoint(block!.checkpointNumber);
845
- const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPrivateLeaf);
846
- const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
850
+ const swapResult = (await computeL2ToL1MembershipWitness(aztecNode, swapPrivateLeaf, withdrawReceipt.txHash))!;
851
+ const { epochNumber: epoch } = swapResult;
852
+ const withdrawResult = (await computeL2ToL1MembershipWitness(aztecNode, withdrawLeaf, withdrawReceipt.txHash))!;
847
853
 
848
- const swapPrivateL2MessageIndex = swapResult!.leafIndex;
849
- const swapPrivateSiblingPath = swapResult!.siblingPath;
854
+ const swapPrivateL2MessageIndex = swapResult.leafIndex;
855
+ const swapPrivateSiblingPath = swapResult.siblingPath;
850
856
 
851
- const withdrawL2MessageIndex = withdrawResult!.leafIndex;
852
- const withdrawSiblingPath = withdrawResult!.siblingPath;
857
+ const withdrawL2MessageIndex = withdrawResult.leafIndex;
858
+ const withdrawSiblingPath = withdrawResult.siblingPath;
853
859
 
854
860
  const withdrawMessageMetadata = {
855
861
  _epoch: BigInt(epoch),
@@ -973,16 +979,15 @@ export const uniswapL1L2TestSuite = (
973
979
  chainId: new Fr(l1Client.chain.id),
974
980
  });
975
981
 
976
- const block = await aztecNode.getBlock(withdrawReceipt.blockNumber!);
977
- const epoch = await rollup.getEpochNumberForCheckpoint(block!.checkpointNumber);
978
- const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPublicLeaf);
979
- const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
982
+ const swapResult = (await computeL2ToL1MembershipWitness(aztecNode, swapPublicLeaf, withdrawReceipt.txHash))!;
983
+ const { epochNumber: epoch } = swapResult;
984
+ const withdrawResult = (await computeL2ToL1MembershipWitness(aztecNode, withdrawLeaf, withdrawReceipt.txHash))!;
980
985
 
981
- const swapPublicL2MessageIndex = swapResult!.leafIndex;
982
- const swapPublicSiblingPath = swapResult!.siblingPath;
986
+ const swapPublicL2MessageIndex = swapResult.leafIndex;
987
+ const swapPublicSiblingPath = swapResult.siblingPath;
983
988
 
984
- const withdrawL2MessageIndex = withdrawResult!.leafIndex;
985
- const withdrawSiblingPath = withdrawResult!.siblingPath;
989
+ const withdrawL2MessageIndex = withdrawResult.leafIndex;
990
+ const withdrawSiblingPath = withdrawResult.siblingPath;
986
991
 
987
992
  const withdrawMessageMetadata = {
988
993
  _epoch: BigInt(epoch),
@@ -94,7 +94,9 @@ export class LendingSimulator {
94
94
 
95
95
  async prepare() {
96
96
  this.accumulator = BASE;
97
- const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.timestamp()) + BigInt(this.ethereumSlotDuration));
97
+ const slot = await this.rollup.getSlotAt(
98
+ BigInt(await this.cc.eth.lastBlockTimestamp()) + BigInt(this.ethereumSlotDuration),
99
+ );
98
100
  this.time = Number(await this.rollup.getTimestampForSlot(slot));
99
101
  }
100
102
 
@@ -103,7 +105,7 @@ export class LendingSimulator {
103
105
  return;
104
106
  }
105
107
 
106
- const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.timestamp()));
108
+ const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.lastBlockTimestamp()));
107
109
  const targetSlot = SlotNumber(slot + diff);
108
110
  const ts = Number(await this.rollup.getTimestampForSlot(targetSlot));
109
111
  const timeDiff = ts - this.time;
@@ -110,7 +110,7 @@ export class TokenSimulator {
110
110
  chunk(calls, 5).map(batch => new BatchCall(this.defaultWallet, batch).simulate({ from: this.defaultAddress })),
111
111
  )
112
112
  )
113
- .flat()
113
+ .flatMap(r => r.result)
114
114
  .map(r => r.result);
115
115
  expect(results[0]).toEqual(this.totalSupply);
116
116
 
@@ -129,16 +129,27 @@ export async function deploySponsoredTestAccountsWithTokens(
129
129
  }
130
130
 
131
131
  async function deployAccountWithDiagnostics(
132
- account: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any },
132
+ account: { getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>; address: any },
133
133
  paymentMethod: SponsoredFeePaymentMethod,
134
134
  aztecNode: AztecNode,
135
135
  logger: Logger,
136
136
  accountLabel: string,
137
+ estimateGas?: boolean,
137
138
  ): Promise<void> {
138
139
  const deployMethod = await account.getDeployMethod();
139
140
  let txHash;
140
141
  try {
141
- const deployResult = await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: NO_WAIT });
142
+ let gasSettings;
143
+ if (estimateGas) {
144
+ const sim = await deployMethod.simulate({ from: AztecAddress.ZERO, fee: { paymentMethod } });
145
+ gasSettings = sim.estimatedGas;
146
+ logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
147
+ }
148
+ const deployResult = await deployMethod.send({
149
+ from: AztecAddress.ZERO,
150
+ fee: { paymentMethod, gasSettings },
151
+ wait: NO_WAIT,
152
+ });
142
153
  txHash = deployResult.txHash;
143
154
  await waitForTx(aztecNode, txHash, { timeout: 2400 });
144
155
  logger.info(`${accountLabel} deployed at ${account.address}`);
@@ -161,18 +172,29 @@ async function deployAccountWithDiagnostics(
161
172
  }
162
173
 
163
174
  async function deployAccountsInBatches(
164
- accounts: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any }[],
175
+ accounts: {
176
+ getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>;
177
+ address: any;
178
+ }[],
165
179
  paymentMethod: SponsoredFeePaymentMethod,
166
180
  aztecNode: AztecNode,
167
181
  logger: Logger,
168
182
  labelPrefix: string,
169
183
  batchSize = 2,
184
+ estimateGas?: boolean,
170
185
  ): Promise<void> {
171
186
  for (let i = 0; i < accounts.length; i += batchSize) {
172
187
  const batch = accounts.slice(i, i + batchSize);
173
188
  await Promise.all(
174
189
  batch.map((account, idx) =>
175
- deployAccountWithDiagnostics(account, paymentMethod, aztecNode, logger, `${labelPrefix}${i + idx + 1}`),
190
+ deployAccountWithDiagnostics(
191
+ account,
192
+ paymentMethod,
193
+ aztecNode,
194
+ logger,
195
+ `${labelPrefix}${i + idx + 1}`,
196
+ estimateGas,
197
+ ),
176
198
  ),
177
199
  );
178
200
  }
@@ -183,6 +205,7 @@ export async function deploySponsoredTestAccounts(
183
205
  aztecNode: AztecNode,
184
206
  logger: Logger,
185
207
  numberOfFundedWallets = 1,
208
+ opts?: { estimateGas?: boolean },
186
209
  ): Promise<TestAccountsWithoutTokens> {
187
210
  const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
188
211
  const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
@@ -192,8 +215,23 @@ export async function deploySponsoredTestAccounts(
192
215
 
193
216
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
194
217
 
195
- await deployAccountWithDiagnostics(recipientAccount, paymentMethod, aztecNode, logger, 'Recipient account');
196
- await deployAccountsInBatches(fundedAccounts, paymentMethod, aztecNode, logger, 'Funded account ', 2);
218
+ await deployAccountWithDiagnostics(
219
+ recipientAccount,
220
+ paymentMethod,
221
+ aztecNode,
222
+ logger,
223
+ 'Recipient account',
224
+ opts?.estimateGas,
225
+ );
226
+ await deployAccountsInBatches(
227
+ fundedAccounts,
228
+ paymentMethod,
229
+ aztecNode,
230
+ logger,
231
+ 'Funded account ',
232
+ 2,
233
+ opts?.estimateGas,
234
+ );
197
235
 
198
236
  return {
199
237
  aztecNode,
@@ -8,6 +8,7 @@ const logger = createLogger('e2e:k8s-utils');
8
8
  const testConfigSchema = z.object({
9
9
  NAMESPACE: z.string().default('scenario'),
10
10
  REAL_VERIFIER: schemas.Boolean.optional().default(true),
11
+ DEBUG_FORCE_TX_PROOF_VERIFICATION: schemas.Boolean.optional().default(true),
11
12
  CREATE_ETH_DEVNET: schemas.Boolean.optional().default(false),
12
13
  L1_RPC_URLS_JSON: z.string().optional(),
13
14
  L1_ACCOUNT_MNEMONIC: z.string().optional(),
@@ -66,3 +66,6 @@ export { getPublicViemClient, getL1DeploymentAddresses, getNodeClient } from './
66
66
 
67
67
  // Health checks
68
68
  export { ChainHealth, type ChainHealthSnapshot } from './health.js';
69
+
70
+ // Pod log extraction
71
+ export { type BlockBuiltLogEntry, fetchBlockBuiltLogs } from './pod_logs.js';