@aztec/end-to-end 0.0.1-commit.88e6f9396 → 0.0.1-commit.8c0b8ff

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 (92) hide show
  1. package/README.md +27 -0
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  4. package/dest/bench/client_flows/client_flows_benchmark.js +3 -4
  5. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -2
  6. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  7. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +1 -1
  8. package/dest/e2e_fees/fees_test.js +1 -1
  9. package/dest/e2e_p2p/inactivity_slash_test.d.ts +1 -1
  10. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  11. package/dest/e2e_p2p/inactivity_slash_test.js +1 -0
  12. package/dest/e2e_p2p/p2p_network.d.ts +1 -1
  13. package/dest/e2e_p2p/p2p_network.js +1 -1
  14. package/dest/e2e_p2p/reqresp/utils.d.ts +1 -1
  15. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
  16. package/dest/e2e_p2p/reqresp/utils.js +2 -15
  17. package/dest/e2e_p2p/shared.d.ts +13 -1
  18. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  19. package/dest/e2e_p2p/shared.js +23 -0
  20. package/dest/fixtures/authwit_proxy.d.ts +1 -1
  21. package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
  22. package/dest/fixtures/authwit_proxy.js +4 -0
  23. package/dest/fixtures/setup.d.ts +4 -5
  24. package/dest/fixtures/setup.d.ts.map +1 -1
  25. package/dest/fixtures/setup.js +12 -9
  26. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  27. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  28. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  29. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  30. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  31. package/dest/forward-compatibility/wallet_service.js +109 -0
  32. package/dest/legacy-jest-resolver.d.cts +3 -0
  33. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  34. package/dest/shared/jest_setup.js +1 -41
  35. package/dest/shared/submit-transactions.d.ts +1 -1
  36. package/dest/shared/submit-transactions.d.ts.map +1 -1
  37. package/dest/simulators/lending_simulator.d.ts +1 -1
  38. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  39. package/dest/simulators/lending_simulator.js +2 -2
  40. package/dest/simulators/token_simulator.js +1 -1
  41. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  42. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  43. package/dest/spartan/setup_test_wallets.js +6 -6
  44. package/dest/spartan/tx_metrics.js +1 -1
  45. package/dest/spartan/utils/config.d.ts +1 -7
  46. package/dest/spartan/utils/config.d.ts.map +1 -1
  47. package/dest/spartan/utils/config.js +1 -3
  48. package/dest/spartan/utils/index.d.ts +1 -2
  49. package/dest/spartan/utils/index.d.ts.map +1 -1
  50. package/dest/spartan/utils/index.js +0 -2
  51. package/dest/spartan/utils/nodes.d.ts +5 -4
  52. package/dest/spartan/utils/nodes.d.ts.map +1 -1
  53. package/dest/spartan/utils/nodes.js +9 -9
  54. package/dest/test-wallet/test_wallet.d.ts +16 -8
  55. package/dest/test-wallet/test_wallet.d.ts.map +1 -1
  56. package/dest/test-wallet/test_wallet.js +102 -67
  57. package/dest/test-wallet/worker_wallet.d.ts +4 -4
  58. package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
  59. package/dest/test-wallet/worker_wallet_schema.d.ts +3 -3
  60. package/package.json +45 -42
  61. package/src/bench/client_flows/client_flows_benchmark.ts +3 -3
  62. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +3 -6
  63. package/src/e2e_fees/fees_test.ts +1 -1
  64. package/src/e2e_p2p/inactivity_slash_test.ts +1 -0
  65. package/src/e2e_p2p/p2p_network.ts +1 -1
  66. package/src/e2e_p2p/reqresp/utils.ts +2 -23
  67. package/src/e2e_p2p/shared.ts +42 -0
  68. package/src/fixtures/authwit_proxy.ts +4 -0
  69. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  70. package/src/fixtures/setup.ts +14 -12
  71. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  72. package/src/forward-compatibility/wallet_service.ts +104 -0
  73. package/src/legacy-jest-resolver.cjs +135 -0
  74. package/src/shared/jest_setup.ts +1 -51
  75. package/src/shared/submit-transactions.ts +4 -1
  76. package/src/simulators/lending_simulator.ts +4 -2
  77. package/src/simulators/token_simulator.ts +1 -1
  78. package/src/spartan/setup_test_wallets.ts +6 -5
  79. package/src/spartan/tx_metrics.ts +1 -1
  80. package/src/spartan/utils/config.ts +0 -2
  81. package/src/spartan/utils/index.ts +0 -3
  82. package/src/spartan/utils/nodes.ts +10 -15
  83. package/src/test-wallet/test_wallet.ts +129 -72
  84. package/src/test-wallet/worker_wallet.ts +3 -2
  85. package/dest/fixtures/elu_monitor.d.ts +0 -21
  86. package/dest/fixtures/elu_monitor.d.ts.map +0 -1
  87. package/dest/fixtures/elu_monitor.js +0 -102
  88. package/dest/spartan/utils/pod_logs.d.ts +0 -25
  89. package/dest/spartan/utils/pod_logs.d.ts.map +0 -1
  90. package/dest/spartan/utils/pod_logs.js +0 -74
  91. package/src/fixtures/elu_monitor.ts +0 -126
  92. package/src/spartan/utils/pod_logs.ts +0 -99
@@ -1,126 +0,0 @@
1
- import { appendFileSync } from 'node:fs';
2
- import { type EventLoopUtilization, type IntervalHistogram, monitorEventLoopDelay, performance } from 'node:perf_hooks';
3
-
4
- const NANOS_PER_MS = 1_000_000;
5
-
6
- /** Samples event-loop utilization, delay histogram, and heap usage per test, writing columnar text to a file. */
7
- export class EluMonitor {
8
- private filePath: string;
9
- private intervalMs: number;
10
- private timer: ReturnType<typeof setInterval> | undefined;
11
- private lastELU: EventLoopUtilization | undefined;
12
- private histogram: IntervalHistogram;
13
- private testName: string | undefined;
14
- private testStart: number | undefined;
15
- private eluSamples: number[] = [];
16
-
17
- constructor(filePath: string, intervalMs?: number) {
18
- this.filePath = filePath;
19
- this.intervalMs = intervalMs ?? 2000;
20
- this.histogram = monitorEventLoopDelay({ resolution: 20 });
21
- }
22
-
23
- /** Begin sampling for a test. Writes a header line and starts the periodic sampler. */
24
- startTest(testName: string): void {
25
- this.stopTest();
26
-
27
- this.testName = testName;
28
- this.testStart = performance.now();
29
- this.eluSamples = [];
30
-
31
- appendFileSync(this.filePath, `\n=== Test: ${testName} ===\n`);
32
- appendFileSync(
33
- this.filePath,
34
- padColumns('TIME', 'ELU', 'EL_DLY_P50', 'EL_DLY_P99', 'EL_DLY_MAX', 'HEAP_MB') + '\n',
35
- );
36
-
37
- this.lastELU = performance.eventLoopUtilization();
38
- this.histogram.enable();
39
-
40
- this.timer = setInterval(() => this.sample(), this.intervalMs);
41
- // Allow the process to exit even if the timer is still running.
42
- this.timer.unref();
43
- }
44
-
45
- /** Stop sampling and write a summary line. */
46
- stopTest(): void {
47
- if (!this.timer) {
48
- return;
49
- }
50
-
51
- // Take a final sample before stopping.
52
- this.sample();
53
-
54
- clearInterval(this.timer);
55
- this.timer = undefined;
56
- this.histogram.disable();
57
- this.histogram.reset();
58
-
59
- this.writeSummary();
60
-
61
- this.lastELU = undefined;
62
- this.testName = undefined;
63
- this.testStart = undefined;
64
- this.eluSamples = [];
65
- }
66
-
67
- /** Alias for stopTest — call on process exit to flush any remaining data. */
68
- stop(): void {
69
- this.stopTest();
70
- }
71
-
72
- private sample(): void {
73
- const newELU = performance.eventLoopUtilization();
74
- const delta = performance.eventLoopUtilization(newELU, this.lastELU);
75
- this.lastELU = newELU;
76
-
77
- const elu = delta.utilization;
78
- this.eluSamples.push(elu);
79
-
80
- const p50 = this.histogram.percentile(50) / NANOS_PER_MS;
81
- const p99 = this.histogram.percentile(99) / NANOS_PER_MS;
82
- const max = this.histogram.max / NANOS_PER_MS;
83
- const heapMb = Math.round(process.memoryUsage().heapUsed / (1024 * 1024));
84
-
85
- const now = new Date();
86
- const time = [now.getHours(), now.getMinutes(), now.getSeconds()].map(n => String(n).padStart(2, '0')).join(':');
87
-
88
- const line = padColumns(
89
- time,
90
- elu.toFixed(2),
91
- `${p50.toFixed(1)}ms`,
92
- `${p99.toFixed(1)}ms`,
93
- `${max.toFixed(1)}ms`,
94
- String(heapMb),
95
- );
96
- appendFileSync(this.filePath, line + '\n');
97
-
98
- // Reset histogram so next sample only reflects the new interval.
99
- this.histogram.reset();
100
- }
101
-
102
- private writeSummary(): void {
103
- if (this.eluSamples.length === 0 || this.testStart === undefined) {
104
- return;
105
- }
106
-
107
- const mean = this.eluSamples.reduce((a, b) => a + b, 0) / this.eluSamples.length;
108
- const maxElu = Math.max(...this.eluSamples);
109
- const sorted = [...this.eluSamples].sort((a, b) => a - b);
110
- const p90Elu = sorted[Math.floor(sorted.length * 0.9)] ?? maxElu;
111
- const durationS = ((performance.now() - this.testStart) / 1000).toFixed(1);
112
-
113
- let summary = `--- Summary: mean_elu=${mean.toFixed(2)} max_elu=${maxElu.toFixed(2)} p90_elu=${p90Elu.toFixed(2)} duration=${durationS}s`;
114
- if (maxElu > 0.85) {
115
- summary += ' WARNING:ELU>0.85';
116
- }
117
- summary += ' ---\n';
118
-
119
- appendFileSync(this.filePath, summary);
120
- }
121
- }
122
-
123
- function padColumns(...cols: string[]): string {
124
- const widths = [11, 7, 12, 12, 12, 8];
125
- return cols.map((col, i) => col.padEnd(widths[i] ?? 10)).join('');
126
- }
@@ -1,99 +0,0 @@
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
- }