@aztec/end-to-end 0.0.1-commit.5914bae → 0.0.1-commit.59a0419c6

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 (110) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +1 -1
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +13 -27
  4. package/dest/e2e_epochs/epochs_test.d.ts +16 -1
  5. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  6. package/dest/e2e_epochs/epochs_test.js +56 -8
  7. package/dest/e2e_fees/fees_test.d.ts +1 -1
  8. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  9. package/dest/e2e_fees/fees_test.js +2 -2
  10. package/dest/e2e_p2p/inactivity_slash_test.d.ts +1 -1
  11. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  12. package/dest/e2e_p2p/inactivity_slash_test.js +2 -3
  13. package/dest/e2e_p2p/p2p_network.d.ts +11 -10
  14. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  15. package/dest/e2e_p2p/p2p_network.js +47 -28
  16. package/dest/e2e_p2p/reqresp/utils.d.ts +1 -1
  17. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
  18. package/dest/e2e_p2p/reqresp/utils.js +16 -3
  19. package/dest/e2e_p2p/shared.d.ts +5 -19
  20. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  21. package/dest/e2e_p2p/shared.js +36 -70
  22. package/dest/fixtures/e2e_prover_test.d.ts +4 -3
  23. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  24. package/dest/fixtures/e2e_prover_test.js +7 -12
  25. package/dest/fixtures/elu_monitor.d.ts +21 -0
  26. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  27. package/dest/fixtures/elu_monitor.js +102 -0
  28. package/dest/fixtures/fixtures.d.ts +12 -1
  29. package/dest/fixtures/fixtures.d.ts.map +1 -1
  30. package/dest/fixtures/fixtures.js +10 -0
  31. package/dest/fixtures/get_bb_config.d.ts +1 -1
  32. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  33. package/dest/fixtures/get_bb_config.js +5 -5
  34. package/dest/fixtures/ha_setup.d.ts +2 -2
  35. package/dest/fixtures/ha_setup.d.ts.map +1 -1
  36. package/dest/fixtures/ha_setup.js +1 -1
  37. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  38. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  39. package/dest/fixtures/schnorr_hardcoded_account_contract.js +39 -0
  40. package/dest/fixtures/setup.d.ts +17 -9
  41. package/dest/fixtures/setup.d.ts.map +1 -1
  42. package/dest/fixtures/setup.js +28 -12
  43. package/dest/fixtures/setup_p2p_test.d.ts +6 -6
  44. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  45. package/dest/fixtures/setup_p2p_test.js +8 -8
  46. package/dest/fixtures/token_utils.d.ts +1 -1
  47. package/dest/fixtures/token_utils.d.ts.map +1 -1
  48. package/dest/fixtures/token_utils.js +2 -5
  49. package/dest/shared/gas_portal_test_harness.js +1 -1
  50. package/dest/shared/jest_setup.js +41 -1
  51. package/dest/shared/submit-transactions.d.ts +1 -1
  52. package/dest/shared/submit-transactions.d.ts.map +1 -1
  53. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  54. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  55. package/dest/shared/uniswap_l1_l2.js +0 -4
  56. package/dest/simulators/token_simulator.js +1 -1
  57. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  58. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  59. package/dest/spartan/setup_test_wallets.js +58 -40
  60. package/dest/spartan/tx_metrics.d.ts +1 -1
  61. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  62. package/dest/spartan/tx_metrics.js +16 -2
  63. package/dest/spartan/utils/config.d.ts +7 -1
  64. package/dest/spartan/utils/config.d.ts.map +1 -1
  65. package/dest/spartan/utils/config.js +3 -1
  66. package/dest/spartan/utils/index.d.ts +2 -1
  67. package/dest/spartan/utils/index.d.ts.map +1 -1
  68. package/dest/spartan/utils/index.js +2 -0
  69. package/dest/spartan/utils/nodes.d.ts +4 -5
  70. package/dest/spartan/utils/nodes.d.ts.map +1 -1
  71. package/dest/spartan/utils/nodes.js +9 -9
  72. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  73. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  74. package/dest/spartan/utils/pod_logs.js +74 -0
  75. package/dest/test-wallet/test_wallet.d.ts +1 -1
  76. package/dest/test-wallet/test_wallet.d.ts.map +1 -1
  77. package/dest/test-wallet/test_wallet.js +10 -4
  78. package/dest/test-wallet/worker_wallet_schema.d.ts +6 -1
  79. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
  80. package/package.json +42 -44
  81. package/src/bench/client_flows/client_flows_benchmark.ts +31 -22
  82. package/src/e2e_epochs/epochs_test.ts +56 -7
  83. package/src/e2e_fees/fees_test.ts +4 -2
  84. package/src/e2e_p2p/inactivity_slash_test.ts +2 -3
  85. package/src/e2e_p2p/p2p_network.ts +58 -40
  86. package/src/e2e_p2p/reqresp/utils.ts +24 -3
  87. package/src/e2e_p2p/shared.ts +33 -103
  88. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  89. package/src/fixtures/e2e_prover_test.ts +12 -17
  90. package/src/fixtures/elu_monitor.ts +126 -0
  91. package/src/fixtures/fixtures.ts +22 -0
  92. package/src/fixtures/get_bb_config.ts +7 -6
  93. package/src/fixtures/ha_setup.ts +4 -2
  94. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  95. package/src/fixtures/setup.ts +43 -16
  96. package/src/fixtures/setup_p2p_test.ts +9 -9
  97. package/src/fixtures/token_utils.ts +1 -4
  98. package/src/guides/up_quick_start.sh +0 -2
  99. package/src/shared/gas_portal_test_harness.ts +0 -1
  100. package/src/shared/jest_setup.ts +51 -1
  101. package/src/shared/submit-transactions.ts +1 -4
  102. package/src/shared/uniswap_l1_l2.ts +0 -4
  103. package/src/simulators/token_simulator.ts +1 -1
  104. package/src/spartan/setup_test_wallets.ts +59 -36
  105. package/src/spartan/tx_metrics.ts +14 -2
  106. package/src/spartan/utils/config.ts +2 -0
  107. package/src/spartan/utils/index.ts +3 -0
  108. package/src/spartan/utils/nodes.ts +15 -10
  109. package/src/spartan/utils/pod_logs.ts +99 -0
  110. package/src/test-wallet/test_wallet.ts +9 -3
@@ -173,7 +173,7 @@ export async function withSequencersAdmin<T>(env: TestConfig, fn: (node: AztecNo
173
173
  if (statusRes.status !== 200) {
174
174
  throw new Error(`Admin endpoint returned status ${statusRes.status}`);
175
175
  }
176
- const client = createAztecNodeAdminClient(url);
176
+ const client = createAztecNodeAdminClient(url, {}, undefined, env.AZTEC_ADMIN_API_KEY);
177
177
  return { result: await fn(client), process };
178
178
  } catch (err) {
179
179
  // Kill the port-forward before retrying
@@ -255,21 +255,18 @@ export async function initHADb(namespace: string): Promise<void> {
255
255
  }
256
256
 
257
257
  /**
258
- * Enables or disables probabilistic transaction dropping on validators and waits for rollout.
259
- * Wired to env vars P2P_DROP_TX and P2P_DROP_TX_CHANCE via Helm values.
258
+ * Sets probabilistic transaction dropping on validators and waits for rollout.
259
+ * Use probability=0 to disable. Wired to env var P2P_DROP_TX_CHANCE via Helm values.
260
260
  */
261
261
  export async function setValidatorTxDrop({
262
262
  namespace,
263
- enabled,
264
263
  probability,
265
264
  logger: log,
266
265
  }: {
267
266
  namespace: string;
268
- enabled: boolean;
269
267
  probability: number;
270
268
  logger: Logger;
271
269
  }) {
272
- const drop = enabled ? 'true' : 'false';
273
270
  const prob = String(probability);
274
271
 
275
272
  const selectors = ['app.kubernetes.io/name=validator', 'app.kubernetes.io/component=validator', 'app=validator'];
@@ -284,7 +281,7 @@ export async function setValidatorTxDrop({
284
281
  if (names.length === 0) {
285
282
  continue;
286
283
  }
287
- const cmd = `kubectl set env statefulset -l ${selector} -n ${namespace} P2P_DROP_TX=${drop} P2P_DROP_TX_CHANCE=${prob}`;
284
+ const cmd = `kubectl set env statefulset -l ${selector} -n ${namespace} P2P_DROP_TX_CHANCE=${prob}`;
288
285
  log.info(`command: ${cmd}`);
289
286
  await execAsync(cmd);
290
287
  updated = true;
@@ -366,16 +363,24 @@ export async function enableValidatorDynamicBootNode(
366
363
  */
367
364
  export async function rollAztecPods(namespace: string, clearState: boolean = false) {
368
365
  // Pod components use 'validator', but StatefulSets and PVCs use 'sequencer-node' for validators
366
+ // RPC nodes have nodeType='rpc-node' in Helm values, so their component label is 'rpc-node' (not 'rpc')
369
367
  const podComponents = [
370
368
  'p2p-bootstrap',
371
369
  'prover-node',
372
370
  'prover-broker',
373
371
  'prover-agent',
374
372
  'sequencer-node',
375
- 'rpc',
373
+ 'rpc-node',
374
+ 'validator-ha-db',
375
+ ];
376
+ const pvcComponents = [
377
+ 'p2p-bootstrap',
378
+ 'prover-node',
379
+ 'prover-broker',
380
+ 'sequencer-node',
381
+ 'rpc-node',
376
382
  'validator-ha-db',
377
383
  ];
378
- const pvcComponents = ['p2p-bootstrap', 'prover-node', 'prover-broker', 'sequencer-node', 'rpc', 'validator-ha-db'];
379
384
  // StatefulSet components that need to be scaled down before PVC deletion
380
385
  // Note: validators use 'sequencer-node' as component label, not 'validator'
381
386
  const statefulSetComponents = [
@@ -383,7 +388,7 @@ export async function rollAztecPods(namespace: string, clearState: boolean = fal
383
388
  'prover-node',
384
389
  'prover-broker',
385
390
  'sequencer-node',
386
- 'rpc',
391
+ 'rpc-node',
387
392
  'validator-ha-db',
388
393
  ];
389
394
 
@@ -0,0 +1,99 @@
1
+ import type { Logger } from '@aztec/foundation/log';
2
+
3
+ import { exec } from 'child_process';
4
+ import { promisify } from 'util';
5
+
6
+ import { getSequencers } from './nodes.js';
7
+
8
+ const execAsync = promisify(exec);
9
+
10
+ /** Parsed l2-block-built stats from a sequencer pod log line. */
11
+ export type BlockBuiltLogEntry = {
12
+ blockNumber: number;
13
+ txCount: number;
14
+ duration: number;
15
+ publicProcessDuration: number;
16
+ manaPerSec: number;
17
+ privateLogCount: number;
18
+ publicLogCount: number;
19
+ contractClassLogCount: number;
20
+ contractClassLogSize: number;
21
+ };
22
+
23
+ const FIELDS: (keyof BlockBuiltLogEntry)[] = [
24
+ 'blockNumber',
25
+ 'txCount',
26
+ 'duration',
27
+ 'publicProcessDuration',
28
+ 'manaPerSec',
29
+ 'privateLogCount',
30
+ 'publicLogCount',
31
+ 'contractClassLogCount',
32
+ 'contractClassLogSize',
33
+ ];
34
+
35
+ /**
36
+ * Fetches l2-block-built log entries from sequencer pods for given block numbers.
37
+ * Queries all validator pods (only the proposer will have the log for a given block).
38
+ *
39
+ * @param namespace - Kubernetes namespace
40
+ * @param sinceTime - ISO 8601 timestamp to limit log search (e.g., from before block building was re-enabled)
41
+ * @param blockNumbers - Set of block numbers to filter for
42
+ * @param logger - Logger instance
43
+ * @returns Array of parsed BlockBuiltLogEntry, de-duplicated by blockNumber, sorted ascending
44
+ */
45
+ export async function fetchBlockBuiltLogs(
46
+ namespace: string,
47
+ sinceTime: string,
48
+ blockNumbers: Set<number>,
49
+ logger: Logger,
50
+ ): Promise<BlockBuiltLogEntry[]> {
51
+ const pods = await getSequencers(namespace);
52
+ const entriesByBlock = new Map<number, BlockBuiltLogEntry>();
53
+
54
+ // Subtract 60s from sinceTime to account for clock skew between test runner and k8s pods.
55
+ // Block number filtering ensures we only match the right blocks, so extra lines are harmless.
56
+ const sinceDate = new Date(new Date(sinceTime).getTime() - 60_000);
57
+ const sinceFlag = sinceDate.toISOString();
58
+
59
+ for (const pod of pods) {
60
+ try {
61
+ const cmd = `kubectl logs ${pod} -n ${namespace} -c aztec --since-time=${sinceFlag}`;
62
+ logger.info(`Fetching logs: ${cmd}`);
63
+ const { stdout } = await execAsync(cmd, { maxBuffer: 10 * 1024 * 1024 });
64
+
65
+ const lines = stdout.split('\n');
66
+ const matchingLines = lines.filter(l => l.includes('l2-block-built'));
67
+ logger.info(`Pod ${pod}: ${lines.length} log lines, ${matchingLines.length} contain l2-block-built`);
68
+
69
+ for (const line of matchingLines) {
70
+ try {
71
+ const parsed = JSON.parse(line);
72
+ if (parsed.eventName !== 'l2-block-built' || !blockNumbers.has(parsed.blockNumber)) {
73
+ continue;
74
+ }
75
+ if (entriesByBlock.has(parsed.blockNumber)) {
76
+ continue;
77
+ }
78
+ const entry: BlockBuiltLogEntry = {} as BlockBuiltLogEntry;
79
+ for (const field of FIELDS) {
80
+ entry[field] = parsed[field] ?? 0;
81
+ }
82
+ entriesByBlock.set(entry.blockNumber, entry);
83
+ logger.verbose(`Parsed l2-block-built log for block ${entry.blockNumber}`, entry);
84
+ } catch {
85
+ // Not valid JSON, skip
86
+ }
87
+ }
88
+ } catch (err) {
89
+ logger.warn(`Failed to fetch logs from pod ${pod}: ${err}`);
90
+ }
91
+ }
92
+
93
+ if (entriesByBlock.size < blockNumbers.size) {
94
+ const missing = [...blockNumbers].filter(bn => !entriesByBlock.has(bn));
95
+ logger.warn(`Missing l2-block-built logs for block(s): ${missing.join(', ')}`);
96
+ }
97
+
98
+ return [...entriesByBlock.values()].sort((a, b) => a.blockNumber - b.blockNumber);
99
+ }
@@ -40,6 +40,7 @@ import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
40
40
  import { BaseWallet, type SimulateViaEntrypointOptions } from '@aztec/wallet-sdk/base-wallet';
41
41
  import type { AccountType } from '@aztec/wallets/embedded';
42
42
 
43
+ import { DEFAULT_MIN_FEE_PADDING } from '../fixtures/fixtures.js';
43
44
  import { AztecNodeProxy, ProvenTx } from './utils.js';
44
45
 
45
46
  /**
@@ -63,6 +64,7 @@ export class TestWallet extends BaseWallet {
63
64
  private readonly nodeRef: AztecNodeProxy,
64
65
  ) {
65
66
  super(pxe, nodeRef);
67
+ this.minFeePadding = DEFAULT_MIN_FEE_PADDING;
66
68
  }
67
69
 
68
70
  static async create(
@@ -178,7 +180,7 @@ export class TestWallet extends BaseWallet {
178
180
  }
179
181
 
180
182
  setMinFeePadding(value?: number) {
181
- this.minFeePadding = value ?? 0.5;
183
+ this.minFeePadding = value ?? DEFAULT_MIN_FEE_PADDING;
182
184
  }
183
185
 
184
186
  protected getAccountFromAddress(address: AztecAddress): Promise<Account> {
@@ -258,7 +260,7 @@ export class TestWallet extends BaseWallet {
258
260
  executionPayload: ExecutionPayload,
259
261
  opts: SimulateViaEntrypointOptions,
260
262
  ): Promise<TxSimulationResultWithAppOffset> {
261
- const { from, feeOptions, additionalScopes, skipTxValidation, skipFeeEnforcement } = opts;
263
+ const { from, feeOptions, additionalScopes, skipTxValidation, skipFeeEnforcement, sendMessagesAs } = opts;
262
264
  const scopes = this.scopesFrom(from, additionalScopes);
263
265
  const skipKernels = this.simulationMode !== 'full';
264
266
  const useOverride = this.simulationMode === 'kernelless-override';
@@ -308,6 +310,7 @@ export class TestWallet extends BaseWallet {
308
310
  skipTxValidation,
309
311
  overrides,
310
312
  scopes,
313
+ senderForTags: this.senderForTagsFrom(from, sendMessagesAs),
311
314
  });
312
315
  const appCallOffset = await this.computeAppCallOffset(from, feeOptions);
313
316
  return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
@@ -320,7 +323,10 @@ export class TestWallet extends BaseWallet {
320
323
  gasSettings: opts.fee?.gasSettings,
321
324
  });
322
325
  const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
323
- const txProvingResult = await this.pxe.proveTx(txRequest, this.scopesFrom(opts.from, opts.additionalScopes));
326
+ const txProvingResult = await this.pxe.proveTx(txRequest, {
327
+ scopes: this.scopesFrom(opts.from, opts.additionalScopes),
328
+ senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs),
329
+ });
324
330
  return new ProvenTx(
325
331
  this.aztecNode,
326
332
  await txProvingResult.toTx(),