@aztec/end-to-end 0.0.1-commit.e310a4c8 → 0.0.1-commit.e558bd1c

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 (37) hide show
  1. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +1 -1
  2. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  3. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +3 -2
  4. package/dest/e2e_p2p/shared.d.ts +1 -1
  5. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  6. package/dest/e2e_p2p/shared.js +3 -0
  7. package/dest/fixtures/ha_setup.d.ts +71 -0
  8. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  9. package/dest/fixtures/ha_setup.js +114 -0
  10. package/dest/fixtures/index.d.ts +2 -1
  11. package/dest/fixtures/index.d.ts.map +1 -1
  12. package/dest/fixtures/index.js +1 -0
  13. package/dest/fixtures/setup_p2p_test.d.ts +10 -5
  14. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  15. package/dest/fixtures/setup_p2p_test.js +6 -3
  16. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  17. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  18. package/dest/shared/uniswap_l1_l2.js +7 -5
  19. package/dest/spartan/utils/config.d.ts +4 -1
  20. package/dest/spartan/utils/config.d.ts.map +1 -1
  21. package/dest/spartan/utils/config.js +2 -1
  22. package/dest/spartan/utils/index.d.ts +2 -2
  23. package/dest/spartan/utils/index.d.ts.map +1 -1
  24. package/dest/spartan/utils/scripts.d.ts +18 -4
  25. package/dest/spartan/utils/scripts.d.ts.map +1 -1
  26. package/dest/spartan/utils/scripts.js +19 -4
  27. package/package.json +42 -39
  28. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +3 -4
  29. package/src/e2e_p2p/shared.ts +1 -0
  30. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  31. package/src/fixtures/ha_setup.ts +184 -0
  32. package/src/fixtures/index.ts +1 -0
  33. package/src/fixtures/setup_p2p_test.ts +16 -7
  34. package/src/shared/uniswap_l1_l2.ts +7 -9
  35. package/src/spartan/utils/config.ts +1 -0
  36. package/src/spartan/utils/index.ts +1 -1
  37. package/src/spartan/utils/scripts.ts +43 -7
@@ -15,6 +15,7 @@ const testConfigSchema = z.object({
15
15
  AZTEC_EPOCH_DURATION: z.coerce.number().optional().default(32),
16
16
  AZTEC_PROOF_SUBMISSION_WINDOW: z.coerce.number().optional().default(5),
17
17
  AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: z.coerce.number().optional().default(2),
18
+ FUNDING_PRIVATE_KEY: z.string().optional(),
18
19
  });
19
20
 
20
21
  export type TestConfig = z.infer<typeof testConfigSchema>;
@@ -5,7 +5,7 @@
5
5
  export { type TestConfig, setupEnvironment } from './config.js';
6
6
 
7
7
  // Scripts
8
- export { getGitProjectRoot, getAztecBin, runAztecBin, runProjectScript } from './scripts.js';
8
+ export { type ScriptResult, getGitProjectRoot, getAztecBin, runAztecBin, runProjectScript } from './scripts.js';
9
9
 
10
10
  // K8s operations
11
11
  export {
@@ -3,24 +3,47 @@ import type { Logger } from '@aztec/foundation/log';
3
3
  import { execSync, spawn } from 'child_process';
4
4
  import path from 'path';
5
5
 
6
+ /** Result from running a script */
7
+ export type ScriptResult = {
8
+ exitCode: number;
9
+ stdout: string;
10
+ stderr: string;
11
+ };
12
+
6
13
  /**
7
14
  * @param scriptPath - The path to the script, relative to the project root
8
15
  * @param args - The arguments to pass to the script
9
16
  * @param logger - The logger to use
10
- * @returns The exit code of the script
17
+ * @returns The exit code, stdout, and stderr of the script
11
18
  */
12
- function runScript(scriptPath: string, args: string[], logger: Logger, env?: Record<string, string>) {
19
+ function runScript(
20
+ scriptPath: string,
21
+ args: string[],
22
+ logger: Logger,
23
+ env?: Record<string, string>,
24
+ ): Promise<ScriptResult> {
13
25
  const childProcess = spawn(scriptPath, args, {
14
26
  stdio: ['ignore', 'pipe', 'pipe'],
15
27
  env: env ? { ...process.env, ...env } : process.env,
16
28
  });
17
- return new Promise<number>((resolve, reject) => {
18
- childProcess.on('close', (code: number | null) => resolve(code ?? 0));
29
+ const stdoutChunks: Buffer[] = [];
30
+ const stderrChunks: Buffer[] = [];
31
+
32
+ return new Promise<ScriptResult>((resolve, reject) => {
33
+ childProcess.on('close', (code: number | null) =>
34
+ resolve({
35
+ exitCode: code ?? 0,
36
+ stdout: Buffer.concat(stdoutChunks).toString(),
37
+ stderr: Buffer.concat(stderrChunks).toString(),
38
+ }),
39
+ );
19
40
  childProcess.on('error', reject);
20
41
  childProcess.stdout?.on('data', (data: Buffer) => {
42
+ stdoutChunks.push(data);
21
43
  logger.info(data.toString());
22
44
  });
23
45
  childProcess.stderr?.on('data', (data: Buffer) => {
46
+ stderrChunks.push(data);
24
47
  logger.error(data.toString());
25
48
  });
26
49
  });
@@ -51,13 +74,26 @@ export function getAztecBin() {
51
74
  * @param args - The arguments to pass to the Aztec binary
52
75
  * @param logger - The logger to use
53
76
  * @param env - Optional environment variables to set for the process
54
- * @returns The exit code of the Aztec binary
77
+ * @returns The exit code, stdout, and stderr of the Aztec binary
55
78
  */
56
- export function runAztecBin(args: string[], logger: Logger, env?: Record<string, string>) {
79
+ export function runAztecBin(args: string[], logger: Logger, env?: Record<string, string>): Promise<ScriptResult> {
57
80
  return runScript('node', [getAztecBin(), ...args], logger, env);
58
81
  }
59
82
 
60
- export function runProjectScript(script: string, args: string[], logger: Logger, env?: Record<string, string>) {
83
+ /**
84
+ * Runs a script from the project root
85
+ * @param script - The path to the script, relative to the project root
86
+ * @param args - The arguments to pass to the script
87
+ * @param logger - The logger to use
88
+ * @param env - Optional environment variables to set for the process
89
+ * @returns The exit code, stdout, and stderr of the script
90
+ */
91
+ export function runProjectScript(
92
+ script: string,
93
+ args: string[],
94
+ logger: Logger,
95
+ env?: Record<string, string>,
96
+ ): Promise<ScriptResult> {
61
97
  const scriptPath = script.startsWith('/') ? script : path.join(getGitProjectRoot(), script);
62
98
  return runScript(scriptPath, args, logger, env);
63
99
  }