@aztec/end-to-end 0.0.1-commit.96bb3f7 → 0.0.1-commit.a072138

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 (163) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +3 -2
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/benchmark.js +21 -1
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +12 -13
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  6. package/dest/bench/client_flows/client_flows_benchmark.js +117 -132
  7. package/dest/bench/utils.d.ts +6 -5
  8. package/dest/bench/utils.d.ts.map +1 -1
  9. package/dest/bench/utils.js +9 -7
  10. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +6 -7
  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 +96 -112
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +6 -7
  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 +65 -62
  16. package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -3
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  18. package/dest/e2e_deploy_contract/deploy_test.js +18 -13
  19. package/dest/e2e_epochs/epochs_test.d.ts +7 -1
  20. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  21. package/dest/e2e_epochs/epochs_test.js +30 -8
  22. package/dest/e2e_fees/bridging_race.notest.js +3 -5
  23. package/dest/e2e_fees/fees_test.d.ts +13 -13
  24. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  25. package/dest/e2e_fees/fees_test.js +122 -140
  26. package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
  27. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  28. package/dest/e2e_l1_publisher/write_json.js +14 -13
  29. package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
  30. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  31. package/dest/e2e_nested_contract/nested_contract_test.js +31 -39
  32. package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
  33. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  34. package/dest/e2e_p2p/inactivity_slash_test.js +3 -3
  35. package/dest/e2e_p2p/p2p_network.d.ts +7 -6
  36. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  37. package/dest/e2e_p2p/p2p_network.js +110 -103
  38. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  39. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  40. package/dest/e2e_p2p/reqresp/utils.js +153 -0
  41. package/dest/e2e_p2p/shared.d.ts +6 -6
  42. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  43. package/dest/e2e_p2p/shared.js +9 -16
  44. package/dest/e2e_token_contract/token_contract_test.d.ts +16 -9
  45. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  46. package/dest/e2e_token_contract/token_contract_test.js +89 -91
  47. package/dest/fixtures/e2e_prover_test.d.ts +8 -14
  48. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  49. package/dest/fixtures/e2e_prover_test.js +85 -93
  50. package/dest/fixtures/setup.d.ts +218 -0
  51. package/dest/fixtures/setup.d.ts.map +1 -0
  52. package/dest/fixtures/setup.js +695 -0
  53. package/dest/fixtures/setup_p2p_test.d.ts +4 -5
  54. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  55. package/dest/fixtures/setup_p2p_test.js +24 -19
  56. package/dest/fixtures/token_utils.d.ts +1 -1
  57. package/dest/fixtures/token_utils.d.ts.map +1 -1
  58. package/dest/fixtures/token_utils.js +7 -4
  59. package/dest/fixtures/utils.d.ts +5 -191
  60. package/dest/fixtures/utils.d.ts.map +1 -1
  61. package/dest/fixtures/utils.js +4 -615
  62. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  63. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  64. package/dest/quality_of_service/prometheus_client.js +67 -0
  65. package/dest/shared/cross_chain_test_harness.d.ts +14 -4
  66. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  67. package/dest/shared/cross_chain_test_harness.js +11 -11
  68. package/dest/shared/gas_portal_test_harness.d.ts +11 -1
  69. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  70. package/dest/shared/gas_portal_test_harness.js +1 -1
  71. package/dest/shared/submit-transactions.d.ts +3 -3
  72. package/dest/shared/submit-transactions.d.ts.map +1 -1
  73. package/dest/shared/submit-transactions.js +9 -11
  74. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  75. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  76. package/dest/shared/uniswap_l1_l2.js +12 -12
  77. package/dest/simulators/lending_simulator.d.ts +5 -1
  78. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  79. package/dest/simulators/lending_simulator.js +2 -2
  80. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  81. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  82. package/dest/spartan/setup_test_wallets.js +61 -34
  83. package/dest/spartan/tx_metrics.d.ts +51 -2
  84. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  85. package/dest/spartan/tx_metrics.js +333 -6
  86. package/dest/spartan/utils/bot.d.ts +27 -0
  87. package/dest/spartan/utils/bot.d.ts.map +1 -0
  88. package/dest/spartan/utils/bot.js +141 -0
  89. package/dest/spartan/utils/chaos.d.ts +79 -0
  90. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  91. package/dest/spartan/utils/chaos.js +142 -0
  92. package/dest/spartan/utils/clients.d.ts +39 -0
  93. package/dest/spartan/utils/clients.d.ts.map +1 -0
  94. package/dest/spartan/utils/clients.js +90 -0
  95. package/dest/spartan/utils/config.d.ts +36 -0
  96. package/dest/spartan/utils/config.d.ts.map +1 -0
  97. package/dest/spartan/utils/config.js +20 -0
  98. package/dest/spartan/utils/health.d.ts +63 -0
  99. package/dest/spartan/utils/health.d.ts.map +1 -0
  100. package/dest/spartan/utils/health.js +202 -0
  101. package/dest/spartan/utils/helm.d.ts +15 -0
  102. package/dest/spartan/utils/helm.d.ts.map +1 -0
  103. package/dest/spartan/utils/helm.js +47 -0
  104. package/dest/spartan/utils/index.d.ts +9 -0
  105. package/dest/spartan/utils/index.d.ts.map +1 -0
  106. package/dest/spartan/utils/index.js +18 -0
  107. package/dest/spartan/utils/k8s.d.ts +126 -0
  108. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  109. package/dest/spartan/utils/k8s.js +375 -0
  110. package/dest/spartan/utils/nodes.d.ts +41 -0
  111. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  112. package/dest/spartan/utils/nodes.js +461 -0
  113. package/dest/spartan/utils/scripts.d.ts +16 -0
  114. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  115. package/dest/spartan/utils/scripts.js +66 -0
  116. package/dest/spartan/utils.d.ts +2 -253
  117. package/dest/spartan/utils.d.ts.map +1 -1
  118. package/dest/spartan/utils.js +1 -892
  119. package/package.json +40 -39
  120. package/src/bench/client_flows/benchmark.ts +24 -2
  121. package/src/bench/client_flows/client_flows_benchmark.ts +137 -203
  122. package/src/bench/utils.ts +9 -7
  123. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +104 -142
  124. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +99 -106
  125. package/src/e2e_deploy_contract/deploy_test.ts +21 -14
  126. package/src/e2e_epochs/epochs_test.ts +59 -33
  127. package/src/e2e_fees/bridging_race.notest.ts +3 -9
  128. package/src/e2e_fees/fees_test.ts +171 -217
  129. package/src/e2e_l1_publisher/write_json.ts +16 -13
  130. package/src/e2e_nested_contract/nested_contract_test.ts +33 -56
  131. package/src/e2e_p2p/inactivity_slash_test.ts +5 -5
  132. package/src/e2e_p2p/p2p_network.ts +171 -167
  133. package/src/e2e_p2p/reqresp/utils.ts +207 -0
  134. package/src/e2e_p2p/shared.ts +20 -22
  135. package/src/e2e_token_contract/token_contract_test.ts +103 -118
  136. package/src/fixtures/e2e_prover_test.ts +99 -133
  137. package/src/fixtures/setup.ts +1017 -0
  138. package/src/fixtures/setup_p2p_test.ts +15 -20
  139. package/src/fixtures/token_utils.ts +6 -5
  140. package/src/fixtures/utils.ts +27 -901
  141. package/src/quality_of_service/prometheus_client.ts +113 -0
  142. package/src/shared/cross_chain_test_harness.ts +13 -27
  143. package/src/shared/gas_portal_test_harness.ts +1 -1
  144. package/src/shared/submit-transactions.ts +9 -15
  145. package/src/shared/uniswap_l1_l2.ts +12 -19
  146. package/src/simulators/lending_simulator.ts +2 -2
  147. package/src/spartan/setup_test_wallets.ts +72 -24
  148. package/src/spartan/tx_metrics.ts +255 -9
  149. package/src/spartan/utils/bot.ts +185 -0
  150. package/src/spartan/utils/chaos.ts +253 -0
  151. package/src/spartan/utils/clients.ts +100 -0
  152. package/src/spartan/utils/config.ts +26 -0
  153. package/src/spartan/utils/health.ts +255 -0
  154. package/src/spartan/utils/helm.ts +84 -0
  155. package/src/spartan/utils/index.ts +64 -0
  156. package/src/spartan/utils/k8s.ts +527 -0
  157. package/src/spartan/utils/nodes.ts +538 -0
  158. package/src/spartan/utils/scripts.ts +63 -0
  159. package/src/spartan/utils.ts +1 -1158
  160. package/dest/fixtures/snapshot_manager.d.ts +0 -93
  161. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  162. package/dest/fixtures/snapshot_manager.js +0 -488
  163. package/src/fixtures/snapshot_manager.ts +0 -646
@@ -1,892 +1 @@
1
- import { createLogger } from '@aztec/aztec.js/log';
2
- import { promiseWithResolvers } from '@aztec/foundation/promise';
3
- import { makeBackoff, retry } from '@aztec/foundation/retry';
4
- import { schemas } from '@aztec/foundation/schemas';
5
- import { sleep } from '@aztec/foundation/sleep';
6
- import { createAztecNodeAdminClient, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
7
- import { exec, execSync, spawn } from 'child_process';
8
- import path from 'path';
9
- import { promisify } from 'util';
10
- import { createPublicClient, fallback, http } from 'viem';
11
- import { z } from 'zod';
12
- const execAsync = promisify(exec);
13
- const logger = createLogger('e2e:k8s-utils');
14
- const testConfigSchema = z.object({
15
- NAMESPACE: z.string().default('scenario'),
16
- REAL_VERIFIER: schemas.Boolean.optional().default(true),
17
- CREATE_ETH_DEVNET: schemas.Boolean.optional().default(false),
18
- L1_RPC_URLS_JSON: z.string().optional(),
19
- L1_ACCOUNT_MNEMONIC: z.string().optional(),
20
- AZTEC_SLOT_DURATION: z.coerce.number().optional().default(24),
21
- AZTEC_EPOCH_DURATION: z.coerce.number().optional().default(32),
22
- AZTEC_PROOF_SUBMISSION_WINDOW: z.coerce.number().optional().default(5)
23
- });
24
- export function setupEnvironment(env) {
25
- const config = testConfigSchema.parse(env);
26
- logger.warn(`Loaded env config`, config);
27
- return config;
28
- }
29
- /**
30
- * @param path - The path to the script, relative to the project root
31
- * @param args - The arguments to pass to the script
32
- * @param logger - The logger to use
33
- * @returns The exit code of the script
34
- */ function runScript(path, args, logger, env) {
35
- const childProcess = spawn(path, args, {
36
- stdio: [
37
- 'ignore',
38
- 'pipe',
39
- 'pipe'
40
- ],
41
- env: env ? {
42
- ...process.env,
43
- ...env
44
- } : process.env
45
- });
46
- return new Promise((resolve, reject)=>{
47
- childProcess.on('close', (code)=>resolve(code ?? 0));
48
- childProcess.on('error', reject);
49
- childProcess.stdout?.on('data', (data)=>{
50
- logger.info(data.toString());
51
- });
52
- childProcess.stderr?.on('data', (data)=>{
53
- logger.error(data.toString());
54
- });
55
- });
56
- }
57
- export function getAztecBin() {
58
- return path.join(getGitProjectRoot(), 'yarn-project/aztec/dest/bin/index.js');
59
- }
60
- /**
61
- * Runs the Aztec binary
62
- * @param args - The arguments to pass to the Aztec binary
63
- * @param logger - The logger to use
64
- * @param env - Optional environment variables to set for the process
65
- * @returns The exit code of the Aztec binary
66
- */ export function runAztecBin(args, logger, env) {
67
- return runScript('node', [
68
- getAztecBin(),
69
- ...args
70
- ], logger, env);
71
- }
72
- export function runProjectScript(script, args, logger, env) {
73
- const scriptPath = script.startsWith('/') ? script : path.join(getGitProjectRoot(), script);
74
- return runScript(scriptPath, args, logger, env);
75
- }
76
- export async function startPortForward({ resource, namespace, containerPort, hostPort }) {
77
- const hostPortAsString = hostPort ? hostPort.toString() : '';
78
- logger.debug(`kubectl port-forward -n ${namespace} ${resource} ${hostPortAsString}:${containerPort}`);
79
- const process1 = spawn('kubectl', [
80
- 'port-forward',
81
- '-n',
82
- namespace,
83
- resource,
84
- `${hostPortAsString}:${containerPort}`
85
- ], {
86
- detached: true,
87
- windowsHide: true,
88
- stdio: [
89
- 'ignore',
90
- 'pipe',
91
- 'pipe'
92
- ]
93
- });
94
- let isResolved = false;
95
- const connected = new Promise((resolve)=>{
96
- process1.stdout?.on('data', (data)=>{
97
- const str = data.toString();
98
- if (!isResolved && str.includes('Forwarding from')) {
99
- isResolved = true;
100
- logger.debug(`Port forward for ${resource}: ${str}`);
101
- const port = str.search(/:\d+/);
102
- if (port === -1) {
103
- throw new Error('Port not found in port forward output');
104
- }
105
- const portNumber = parseInt(str.slice(port + 1));
106
- logger.verbose(`Port forwarded for ${resource} at ${portNumber}:${containerPort}`);
107
- resolve(portNumber);
108
- } else {
109
- logger.silent(str);
110
- }
111
- });
112
- process1.stderr?.on('data', (data)=>{
113
- logger.verbose(`Port forward for ${resource}: ${data.toString()}`);
114
- // It's a strange thing:
115
- // If we don't pipe stderr, then the port forwarding does not work.
116
- // Log to silent because this doesn't actually report errors,
117
- // just extremely verbose debug logs.
118
- logger.silent(data.toString());
119
- });
120
- process1.on('close', ()=>{
121
- if (!isResolved) {
122
- isResolved = true;
123
- logger.warn(`Port forward for ${resource} closed before connection established`);
124
- resolve(0);
125
- }
126
- });
127
- process1.on('error', (error)=>{
128
- logger.error(`Port forward for ${resource} error: ${error}`);
129
- resolve(0);
130
- });
131
- process1.on('exit', (code)=>{
132
- logger.verbose(`Port forward for ${resource} exited with code ${code}`);
133
- resolve(0);
134
- });
135
- });
136
- const port = await connected;
137
- return {
138
- process: process1,
139
- port
140
- };
141
- }
142
- export function getExternalIP(namespace, serviceName) {
143
- const { promise, resolve, reject } = promiseWithResolvers();
144
- const process1 = spawn('kubectl', [
145
- 'get',
146
- 'service',
147
- '-n',
148
- namespace,
149
- `${namespace}-${serviceName}`,
150
- '--output',
151
- "jsonpath='{.status.loadBalancer.ingress[0].ip}'"
152
- ], {
153
- stdio: 'pipe'
154
- });
155
- let ip = '';
156
- process1.stdout.on('data', (data)=>{
157
- ip += data;
158
- });
159
- process1.on('error', (err)=>{
160
- reject(err);
161
- });
162
- process1.on('exit', ()=>{
163
- // kubectl prints JSON. Remove the quotes
164
- resolve(ip.replace(/"|'/g, ''));
165
- });
166
- return promise;
167
- }
168
- export function startPortForwardForRPC(namespace, index = 0) {
169
- return startPortForward({
170
- resource: `pod/${namespace}-rpc-aztec-node-${index}`,
171
- namespace,
172
- containerPort: 8080
173
- });
174
- }
175
- export function startPortForwardForEthereum(namespace) {
176
- return startPortForward({
177
- resource: `services/${namespace}-eth-execution`,
178
- namespace,
179
- containerPort: 8545
180
- });
181
- }
182
- export async function deleteResourceByName({ resource, namespace, name, force = false }) {
183
- const command = `kubectl delete ${resource} ${name} -n ${namespace} --ignore-not-found=true --wait=true ${force ? '--force' : ''}`;
184
- logger.info(`command: ${command}`);
185
- const { stdout } = await execAsync(command);
186
- return stdout;
187
- }
188
- export async function deleteResourceByLabel({ resource, namespace, label, timeout = '5m', force = false }) {
189
- try {
190
- // Match both plain and group-qualified names (e.g., "podchaos" or "podchaos.chaos-mesh.org")
191
- const escaped = resource.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
192
- const regex = `(^|\\.)${escaped}(\\.|$)`;
193
- await execAsync(`kubectl api-resources --no-headers -o name | grep -Eq '${regex}'`);
194
- } catch (error) {
195
- logger.warn(`Resource type '${resource}' not found in cluster, skipping deletion ${error}`);
196
- return '';
197
- }
198
- const command = `kubectl delete ${resource} -l ${label} -n ${namespace} --ignore-not-found=true --wait=true --timeout=${timeout} ${force ? '--force' : ''}`;
199
- logger.info(`command: ${command}`);
200
- const { stdout } = await execAsync(command);
201
- return stdout;
202
- }
203
- export async function waitForResourceByLabel({ resource, label, namespace, condition = 'Ready', timeout = '10m' }) {
204
- const command = `kubectl wait ${resource} -l ${label} --for=condition=${condition} -n ${namespace} --timeout=${timeout}`;
205
- logger.info(`command: ${command}`);
206
- const { stdout } = await execAsync(command);
207
- return stdout;
208
- }
209
- export async function waitForResourceByName({ resource, name, namespace, condition = 'Ready', timeout = '10m' }) {
210
- const command = `kubectl wait ${resource}/${name} --for=condition=${condition} -n ${namespace} --timeout=${timeout}`;
211
- logger.info(`command: ${command}`);
212
- const { stdout } = await execAsync(command);
213
- return stdout;
214
- }
215
- export async function waitForResourcesByName({ resource, names, namespace, condition = 'Ready', timeout = '10m' }) {
216
- if (!names.length) {
217
- throw new Error(`No ${resource} names provided to waitForResourcesByName`);
218
- }
219
- // Wait all in parallel; if any fails, surface which one.
220
- await Promise.all(names.map(async (name)=>{
221
- try {
222
- await waitForResourceByName({
223
- resource,
224
- name,
225
- namespace,
226
- condition,
227
- timeout
228
- });
229
- } catch (err) {
230
- throw new Error(`Failed waiting for ${resource}/${name} condition=${condition} timeout=${timeout} namespace=${namespace}: ${String(err)}`);
231
- }
232
- }));
233
- }
234
- export function getChartDir(spartanDir, chartName) {
235
- return path.join(spartanDir.trim(), chartName);
236
- }
237
- function shellQuote(value) {
238
- // Single-quote safe shell escaping: ' -> '\''
239
- return `'${value.replace(/'/g, "'\\''")}'`;
240
- }
241
- function valuesToArgs(values) {
242
- return Object.entries(values).map(([key, value])=>typeof value === 'number' || typeof value === 'boolean' ? `--set ${key}=${value}` : `--set-string ${key}=${shellQuote(String(value))}`).join(' ');
243
- }
244
- function createHelmCommand({ instanceName, helmChartDir, namespace, valuesFile, timeout, values, reuseValues = false }) {
245
- const valuesFileArgs = valuesFile ? `--values ${helmChartDir}/values/${valuesFile}` : '';
246
- const reuseValuesArgs = reuseValues ? '--reuse-values' : '';
247
- return `helm upgrade --install ${instanceName} ${helmChartDir} --namespace ${namespace} ${valuesFileArgs} ${reuseValuesArgs} --wait --timeout=${timeout} ${valuesToArgs(values)}`;
248
- }
249
- async function execHelmCommand(args) {
250
- const helmCommand = createHelmCommand(args);
251
- logger.info(`helm command: ${helmCommand}`);
252
- const { stdout } = await execAsync(helmCommand);
253
- return stdout;
254
- }
255
- async function getHelmReleaseStatus(instanceName, namespace) {
256
- try {
257
- const { stdout } = await execAsync(`helm list --namespace ${namespace} --all --filter '^${instanceName}$' --output json | cat`);
258
- const parsed = JSON.parse(stdout);
259
- const row = parsed.find((r)=>r.name === instanceName);
260
- return row?.status;
261
- } catch {
262
- return undefined;
263
- }
264
- }
265
- async function forceDeleteHelmReleaseRecord(instanceName, namespace, logger) {
266
- const labelSelector = `owner=helm,name=${instanceName}`;
267
- const cmd = `kubectl delete secret -n ${namespace} -l ${labelSelector} --ignore-not-found=true`;
268
- logger.warn(`Force deleting Helm release record: ${cmd}`);
269
- await execAsync(cmd).catch(()=>undefined);
270
- }
271
- async function hasDeployedHelmRelease(instanceName, namespace) {
272
- try {
273
- const status = await getHelmReleaseStatus(instanceName, namespace);
274
- return status?.toLowerCase() === 'deployed';
275
- } catch {
276
- return false;
277
- }
278
- }
279
- export async function uninstallChaosMesh(instanceName, namespace, logger) {
280
- // uninstall the helm chart if it exists
281
- logger.info(`Uninstalling helm chart ${instanceName}`);
282
- await execAsync(`helm uninstall ${instanceName} --namespace ${namespace} --wait --ignore-not-found`);
283
- // and delete the chaos-mesh resources created by this release
284
- const deleteByLabel = async (resource)=>{
285
- const args = {
286
- resource,
287
- namespace: namespace,
288
- label: `app.kubernetes.io/instance=${instanceName}`
289
- };
290
- logger.info(`Deleting ${resource} resources for release ${instanceName}`);
291
- await deleteResourceByLabel(args).catch((e)=>{
292
- logger.error(`Error deleting ${resource}: ${e}`);
293
- logger.info(`Force deleting ${resource}`);
294
- return deleteResourceByLabel({
295
- ...args,
296
- force: true
297
- });
298
- });
299
- };
300
- await deleteByLabel('podchaos');
301
- await deleteByLabel('networkchaos');
302
- await deleteByLabel('podnetworkchaos');
303
- await deleteByLabel('workflows');
304
- await deleteByLabel('workflownodes');
305
- }
306
- /**
307
- * Installs a Helm chart with the given parameters.
308
- * @param instanceName - The name of the Helm chart instance.
309
- * @param targetNamespace - The namespace with the resources to be affected by the Helm chart.
310
- * @param valuesFile - The values file to use for the Helm chart.
311
- * @param chaosMeshNamespace - The namespace to install the Helm chart in.
312
- * @param timeout - The timeout for the Helm command.
313
- * @param clean - Whether to clean up the Helm chart before installing it.
314
- * @returns The stdout of the Helm command.
315
- * @throws If the Helm command fails.
316
- *
317
- * Example usage:
318
- * ```typescript
319
- * const stdout = await installChaosMeshChart({ instanceName: 'force-reorg', targetNamespace: 'smoke', valuesFile: 'prover-failure.yaml'});
320
- * console.log(stdout);
321
- * ```
322
- */ export async function installChaosMeshChart({ instanceName, targetNamespace, valuesFile, helmChartDir, timeout = '10m', clean = true, values = {}, logger }) {
323
- if (clean) {
324
- await uninstallChaosMesh(instanceName, targetNamespace, logger);
325
- }
326
- return execHelmCommand({
327
- instanceName,
328
- helmChartDir,
329
- namespace: targetNamespace,
330
- valuesFile,
331
- timeout,
332
- values: {
333
- ...values,
334
- 'global.targetNamespace': targetNamespace
335
- }
336
- });
337
- }
338
- export function applyProverFailure({ namespace, spartanDir, durationSeconds, logger }) {
339
- return installChaosMeshChart({
340
- instanceName: 'prover-failure',
341
- targetNamespace: namespace,
342
- valuesFile: 'prover-failure.yaml',
343
- helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
344
- values: {
345
- 'proverFailure.duration': `${durationSeconds}s`
346
- },
347
- logger
348
- });
349
- }
350
- export function applyValidatorFailure({ namespace, spartanDir, logger, values, instanceName }) {
351
- return installChaosMeshChart({
352
- instanceName: instanceName ?? 'validator-failure',
353
- targetNamespace: namespace,
354
- valuesFile: 'validator-failure.yaml',
355
- helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
356
- values,
357
- logger
358
- });
359
- }
360
- export function applyProverKill({ namespace, spartanDir, logger, values }) {
361
- return installChaosMeshChart({
362
- instanceName: 'prover-kill',
363
- targetNamespace: namespace,
364
- valuesFile: 'prover-kill.yaml',
365
- helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
366
- chaosMeshNamespace: namespace,
367
- clean: true,
368
- logger,
369
- values
370
- });
371
- }
372
- export function applyProverBrokerKill({ namespace, spartanDir, logger, values }) {
373
- return installChaosMeshChart({
374
- instanceName: 'prover-broker-kill',
375
- targetNamespace: namespace,
376
- valuesFile: 'prover-broker-kill.yaml',
377
- helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
378
- clean: true,
379
- logger,
380
- values
381
- });
382
- }
383
- export function applyBootNodeFailure({ instanceName = 'boot-node-failure', namespace, spartanDir, durationSeconds, logger, values }) {
384
- return installChaosMeshChart({
385
- instanceName,
386
- targetNamespace: namespace,
387
- valuesFile: 'boot-node-failure.yaml',
388
- helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
389
- values: {
390
- 'bootNodeFailure.duration': `${durationSeconds}s`,
391
- ...values ?? {}
392
- },
393
- logger
394
- });
395
- }
396
- export function applyValidatorKill({ instanceName = 'validator-kill', namespace, spartanDir, logger, values, clean = true }) {
397
- return installChaosMeshChart({
398
- instanceName: instanceName ?? 'validator-kill',
399
- targetNamespace: namespace,
400
- valuesFile: 'validator-kill.yaml',
401
- helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
402
- clean,
403
- logger,
404
- values
405
- });
406
- }
407
- export function applyNetworkShaping({ instanceName = 'network-shaping', valuesFile, namespace, spartanDir, logger }) {
408
- return installChaosMeshChart({
409
- instanceName,
410
- targetNamespace: namespace,
411
- valuesFile,
412
- helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
413
- logger
414
- });
415
- }
416
- export async function awaitCheckpointNumber(rollupCheatCodes, checkpointNumber, timeoutSeconds, logger) {
417
- logger.info(`Waiting for checkpoint ${checkpointNumber}`);
418
- let tips = await rollupCheatCodes.getTips();
419
- const endTime = Date.now() + timeoutSeconds * 1000;
420
- while(tips.pending < checkpointNumber && Date.now() < endTime){
421
- logger.info(`At checkpoint ${tips.pending}`);
422
- await sleep(1000);
423
- tips = await rollupCheatCodes.getTips();
424
- }
425
- if (tips.pending < checkpointNumber) {
426
- throw new Error(`Timeout waiting for checkpoint ${checkpointNumber}, only reached ${tips.pending}`);
427
- } else {
428
- logger.info(`Reached checkpoint ${tips.pending}`);
429
- }
430
- }
431
- export async function restartBot(namespace, logger) {
432
- logger.info(`Restarting bot`);
433
- await deleteResourceByLabel({
434
- resource: 'pods',
435
- namespace,
436
- label: 'app.kubernetes.io/name=bot'
437
- });
438
- await sleep(10 * 1000);
439
- // Some bot images may take time to report Ready due to heavy boot-time proving.
440
- // Waiting for PodReadyToStartContainers ensures the pod is scheduled and starting without blocking on full readiness.
441
- await waitForResourceByLabel({
442
- resource: 'pods',
443
- namespace,
444
- label: 'app.kubernetes.io/name=bot',
445
- condition: 'PodReadyToStartContainers'
446
- });
447
- logger.info(`Bot restarted`);
448
- }
449
- /**
450
- * Installs or upgrades the transfer bot Helm release for the given namespace.
451
- * Intended for test setup to enable L2 traffic generation only when needed.
452
- */ export async function installTransferBot({ namespace, spartanDir, logger, replicas = 1, txIntervalSeconds = 10, followChain = 'PENDING', mnemonic = process.env.LABS_INFRA_MNEMONIC ?? 'test test test test test test test test test test test junk', mnemonicStartIndex, botPrivateKey = process.env.BOT_TRANSFERS_L2_PRIVATE_KEY ?? '0xcafe01', nodeUrl, timeout = '15m', reuseValues = true, aztecSlotDuration = Number(process.env.AZTEC_SLOT_DURATION ?? 12) }) {
453
- const instanceName = `${namespace}-bot-transfers`;
454
- const helmChartDir = getChartDir(spartanDir, 'aztec-bot');
455
- const resolvedNodeUrl = nodeUrl ?? `http://${namespace}-rpc-aztec-node.${namespace}.svc.cluster.local:8080`;
456
- logger.info(`Installing/upgrading transfer bot: replicas=${replicas}, followChain=${followChain}`);
457
- const values = {
458
- 'bot.replicaCount': replicas,
459
- 'bot.txIntervalSeconds': txIntervalSeconds,
460
- 'bot.followChain': followChain,
461
- 'bot.botPrivateKey': botPrivateKey,
462
- 'bot.nodeUrl': resolvedNodeUrl,
463
- 'bot.mnemonic': mnemonic,
464
- 'bot.feePaymentMethod': 'fee_juice',
465
- 'aztec.slotDuration': aztecSlotDuration,
466
- // Ensure bot can reach its own PXE started in-process (default rpc.port is 8080)
467
- // Note: since aztec-bot depends on aztec-node with alias `bot`, env vars go under `bot.node.env`.
468
- 'bot.node.env.BOT_PXE_URL': 'http://127.0.0.1:8080',
469
- // Provide L1 execution RPC for bridging fee juice
470
- 'bot.node.env.ETHEREUM_HOSTS': `http://${namespace}-eth-execution.${namespace}.svc.cluster.local:8545`,
471
- // Provide L1 mnemonic for bridging (falls back to labs mnemonic)
472
- 'bot.node.env.BOT_L1_MNEMONIC': mnemonic,
473
- // The bot does not need Kubernetes API access. Disable RBAC + ServiceAccount creation so the chart
474
- // can be installed by users without cluster-scoped RBAC permissions.
475
- 'bot.rbac.create': false,
476
- 'bot.serviceAccount.create': false,
477
- 'bot.serviceAccount.name': 'default'
478
- };
479
- // Ensure we derive a funded L1 key (index 0 is funded on anvil default mnemonic)
480
- if (mnemonicStartIndex === undefined) {
481
- values['bot.mnemonicStartIndex'] = 0;
482
- }
483
- // Also pass a funded private key directly if available
484
- if (process.env.FUNDING_PRIVATE_KEY) {
485
- values['bot.node.env.BOT_L1_PRIVATE_KEY'] = process.env.FUNDING_PRIVATE_KEY;
486
- }
487
- // Align bot image with the running network image: prefer env var, else detect from a validator pod
488
- let repositoryFromEnv;
489
- let tagFromEnv;
490
- const aztecDockerImage = process.env.AZTEC_DOCKER_IMAGE;
491
- if (aztecDockerImage && aztecDockerImage.includes(':')) {
492
- const lastColon = aztecDockerImage.lastIndexOf(':');
493
- repositoryFromEnv = aztecDockerImage.slice(0, lastColon);
494
- tagFromEnv = aztecDockerImage.slice(lastColon + 1);
495
- }
496
- let repository = repositoryFromEnv;
497
- let tag = tagFromEnv;
498
- if (!repository || !tag) {
499
- try {
500
- const { stdout } = await execAsync(`kubectl get pods -l app.kubernetes.io/name=validator -n ${namespace} -o jsonpath='{.items[0].spec.containers[?(@.name=="aztec")].image}' | cat`);
501
- const image = stdout.trim().replace(/^'|'$/g, '');
502
- if (image && image.includes(':')) {
503
- const lastColon = image.lastIndexOf(':');
504
- repository = image.slice(0, lastColon);
505
- tag = image.slice(lastColon + 1);
506
- }
507
- } catch (err) {
508
- logger.warn(`Could not detect aztec image from validator pod: ${String(err)}`);
509
- }
510
- }
511
- if (repository && tag) {
512
- values['global.aztecImage.repository'] = repository;
513
- values['global.aztecImage.tag'] = tag;
514
- }
515
- if (mnemonicStartIndex !== undefined) {
516
- values['bot.mnemonicStartIndex'] = typeof mnemonicStartIndex === 'string' ? mnemonicStartIndex : Number(mnemonicStartIndex);
517
- }
518
- // If a previous install attempt left the release in a non-deployed state (e.g. FAILED),
519
- // `helm upgrade --install` can error with "has no deployed releases".
520
- // In that case, clear the release record and do a clean install.
521
- const existingStatus = await getHelmReleaseStatus(instanceName, namespace);
522
- if (existingStatus && existingStatus.toLowerCase() !== 'deployed') {
523
- logger.warn(`Transfer bot release ${instanceName} is in status '${existingStatus}'. Reinstalling cleanly.`);
524
- await execAsync(`helm uninstall ${instanceName} --namespace ${namespace} --wait --ignore-not-found`).catch(()=>undefined);
525
- // If helm left the release in `uninstalling`, force-delete the record so we can reinstall.
526
- const afterUninstallStatus = await getHelmReleaseStatus(instanceName, namespace);
527
- if (afterUninstallStatus?.toLowerCase() === 'uninstalling') {
528
- await forceDeleteHelmReleaseRecord(instanceName, namespace, logger);
529
- }
530
- }
531
- // `--reuse-values` fails if the release has never successfully deployed (e.g. first install, or a previous failed install).
532
- // Only reuse values when we have a deployed release to reuse from.
533
- const effectiveReuseValues = reuseValues && await hasDeployedHelmRelease(instanceName, namespace);
534
- await execHelmCommand({
535
- instanceName,
536
- helmChartDir,
537
- namespace,
538
- valuesFile: undefined,
539
- timeout,
540
- values: values,
541
- reuseValues: effectiveReuseValues
542
- });
543
- if (replicas > 0) {
544
- await waitForResourceByLabel({
545
- resource: 'pods',
546
- namespace,
547
- label: 'app.kubernetes.io/name=bot',
548
- condition: 'PodReadyToStartContainers'
549
- });
550
- }
551
- }
552
- /**
553
- * Uninstalls the transfer bot Helm release from the given namespace.
554
- * Intended for test teardown to clean up bot resources.
555
- */ export async function uninstallTransferBot(namespace, logger) {
556
- const instanceName = `${namespace}-bot-transfers`;
557
- logger.info(`Uninstalling transfer bot release ${instanceName}`);
558
- await execAsync(`helm uninstall ${instanceName} --namespace ${namespace} --wait --ignore-not-found`);
559
- // Ensure any leftover pods are removed
560
- await deleteResourceByLabel({
561
- resource: 'pods',
562
- namespace,
563
- label: 'app.kubernetes.io/name=bot'
564
- }).catch(()=>undefined);
565
- }
566
- /**
567
- * Enables or disables probabilistic transaction dropping on validators and waits for rollout.
568
- * Wired to env vars P2P_DROP_TX and P2P_DROP_TX_CHANCE via Helm values.
569
- */ export async function setValidatorTxDrop({ namespace, enabled, probability, logger }) {
570
- const drop = enabled ? 'true' : 'false';
571
- const prob = String(probability);
572
- const selectors = [
573
- 'app.kubernetes.io/name=validator',
574
- 'app.kubernetes.io/component=validator',
575
- 'app=validator'
576
- ];
577
- let updated = false;
578
- for (const selector of selectors){
579
- try {
580
- const list = await execAsync(`kubectl get statefulset -l ${selector} -n ${namespace} --no-headers -o name | cat`);
581
- const names = list.stdout.split('\n').map((s)=>s.trim()).filter(Boolean);
582
- if (names.length === 0) {
583
- continue;
584
- }
585
- const cmd = `kubectl set env statefulset -l ${selector} -n ${namespace} P2P_DROP_TX=${drop} P2P_DROP_TX_CHANCE=${prob}`;
586
- logger.info(`command: ${cmd}`);
587
- await execAsync(cmd);
588
- updated = true;
589
- } catch (e) {
590
- logger.warn(`Failed to update validators with selector ${selector}: ${String(e)}`);
591
- }
592
- }
593
- if (!updated) {
594
- logger.warn(`No validator StatefulSets found in ${namespace}. Skipping tx drop toggle.`);
595
- return;
596
- }
597
- // Restart validator pods to ensure env vars take effect and wait for readiness
598
- await restartValidators(namespace, logger);
599
- }
600
- export async function restartValidators(namespace, logger) {
601
- const selectors = [
602
- 'app.kubernetes.io/name=validator',
603
- 'app.kubernetes.io/component=validator',
604
- 'app=validator'
605
- ];
606
- let any = false;
607
- for (const selector of selectors){
608
- try {
609
- const { stdout } = await execAsync(`kubectl get pods -l ${selector} -n ${namespace} --no-headers -o name | cat`);
610
- if (!stdout || stdout.trim().length === 0) {
611
- continue;
612
- }
613
- any = true;
614
- await deleteResourceByLabel({
615
- resource: 'pods',
616
- namespace,
617
- label: selector
618
- });
619
- } catch (e) {
620
- logger.warn(`Error restarting validator pods with selector ${selector}: ${String(e)}`);
621
- }
622
- }
623
- if (!any) {
624
- logger.warn(`No validator pods found to restart in ${namespace}.`);
625
- return;
626
- }
627
- // Wait for either label to be Ready
628
- for (const selector of selectors){
629
- try {
630
- await waitForResourceByLabel({
631
- resource: 'pods',
632
- namespace,
633
- label: selector
634
- });
635
- return;
636
- } catch {
637
- // try next
638
- }
639
- }
640
- logger.warn(`Validator pods did not report Ready; continuing.`);
641
- }
642
- export async function enableValidatorDynamicBootNode(instanceName, namespace, spartanDir, logger) {
643
- logger.info(`Enabling validator dynamic boot node`);
644
- await execHelmCommand({
645
- instanceName,
646
- namespace,
647
- helmChartDir: getChartDir(spartanDir, 'aztec-network'),
648
- values: {
649
- 'validator.dynamicBootNode': 'true'
650
- },
651
- valuesFile: undefined,
652
- timeout: '15m',
653
- reuseValues: true
654
- });
655
- logger.info(`Validator dynamic boot node enabled`);
656
- }
657
- export async function getSequencers(namespace) {
658
- const selectors = [
659
- 'app.kubernetes.io/name=validator',
660
- 'app.kubernetes.io/component=validator',
661
- 'app.kubernetes.io/component=sequencer-node',
662
- 'app=validator'
663
- ];
664
- for (const selector of selectors){
665
- try {
666
- const command = `kubectl get pods -l ${selector} -n ${namespace} -o jsonpath='{.items[*].metadata.name}'`;
667
- const { stdout } = await execAsync(command);
668
- const sequencers = stdout.split(' ').map((s)=>s.trim()).filter(Boolean);
669
- if (sequencers.length > 0) {
670
- logger.verbose(`Found sequencer pods ${sequencers.join(', ')} (selector=${selector})`);
671
- return sequencers;
672
- }
673
- } catch {
674
- // try next selector
675
- }
676
- }
677
- // Fail fast instead of returning [''] which leads to attempts to port-forward `pod/`.
678
- throw new Error(`No sequencer/validator pods found in namespace ${namespace}. Tried selectors: ${selectors.join(', ')}`);
679
- }
680
- export function updateSequencersConfig(env, config) {
681
- return withSequencersAdmin(env, async (client)=>{
682
- await client.setConfig(config);
683
- return client.getConfig();
684
- });
685
- }
686
- export function getSequencersConfig(env) {
687
- return withSequencersAdmin(env, (client)=>client.getConfig());
688
- }
689
- export async function withSequencersAdmin(env, fn) {
690
- const adminContainerPort = 8880;
691
- const namespace = env.NAMESPACE;
692
- const sequencers = await getSequencers(namespace);
693
- const results = [];
694
- for (const sequencer of sequencers){
695
- const { process: process1, port } = await startPortForward({
696
- resource: `pod/${sequencer}`,
697
- namespace,
698
- containerPort: adminContainerPort
699
- });
700
- const url = `http://localhost:${port}`;
701
- await retry(()=>fetch(`${url}/status`).then((res)=>res.status === 200), 'forward node admin port', makeBackoff([
702
- 1,
703
- 1,
704
- 2,
705
- 6
706
- ]), logger, true);
707
- const client = createAztecNodeAdminClient(url);
708
- results.push(await fn(client));
709
- process1.kill();
710
- }
711
- return results;
712
- }
713
- /**
714
- * Returns a public viem client to the eth execution node. If it was part of a local eth devnet,
715
- * it first port-forwards the service and points to it. Otherwise, just uses the external RPC url.
716
- */ export async function getPublicViemClient(env, /** If set, will push the new process into it */ processes) {
717
- const { NAMESPACE, CREATE_ETH_DEVNET, L1_RPC_URLS_JSON } = env;
718
- if (CREATE_ETH_DEVNET) {
719
- logger.info(`Creating port forward to eth execution node`);
720
- const { process: process1, port } = await startPortForward({
721
- resource: `svc/${NAMESPACE}-eth-execution`,
722
- namespace: NAMESPACE,
723
- containerPort: 8545
724
- });
725
- const url = `http://127.0.0.1:${port}`;
726
- const client = createPublicClient({
727
- transport: fallback([
728
- http(url, {
729
- batch: false
730
- })
731
- ])
732
- });
733
- if (processes) {
734
- processes.push(process1);
735
- }
736
- return {
737
- url,
738
- client,
739
- process: process1
740
- };
741
- } else {
742
- logger.info(`Connecting to the eth execution node at ${L1_RPC_URLS_JSON}`);
743
- if (!L1_RPC_URLS_JSON) {
744
- throw new Error(`L1_RPC_URLS_JSON is not defined`);
745
- }
746
- const client = createPublicClient({
747
- transport: fallback([
748
- http(L1_RPC_URLS_JSON, {
749
- batch: false
750
- })
751
- ])
752
- });
753
- return {
754
- url: L1_RPC_URLS_JSON,
755
- client
756
- };
757
- }
758
- }
759
- /** Queries an Aztec node for the L1 deployment addresses */ export async function getL1DeploymentAddresses(env) {
760
- let forwardProcess;
761
- try {
762
- const [sequencer] = await getSequencers(env.NAMESPACE);
763
- const { process: process1, port } = await startPortForward({
764
- resource: `pod/${sequencer}`,
765
- namespace: env.NAMESPACE,
766
- containerPort: 8080
767
- });
768
- forwardProcess = process1;
769
- const url = `http://127.0.0.1:${port}`;
770
- const node = createAztecNodeClient(url);
771
- return await retry(()=>node.getNodeInfo().then((i)=>i.l1ContractAddresses), 'get node info', makeBackoff([
772
- 1,
773
- 3,
774
- 6
775
- ]), logger);
776
- } finally{
777
- forwardProcess?.kill();
778
- }
779
- }
780
- /**
781
- * Rolls the Aztec pods in the given namespace.
782
- * @param namespace - The namespace to roll the Aztec pods in.
783
- * @dev - IMPORTANT: This function DOES NOT delete the underlying PVCs.
784
- * This means that the pods will be restarted with the same persistent storage.
785
- * This is useful for testing, but you should be aware of the implications.
786
- */ export async function rollAztecPods(namespace) {
787
- await deleteResourceByLabel({
788
- resource: 'pods',
789
- namespace: namespace,
790
- label: 'app=boot-node'
791
- });
792
- await deleteResourceByLabel({
793
- resource: 'pods',
794
- namespace: namespace,
795
- label: 'app=prover-node'
796
- });
797
- await deleteResourceByLabel({
798
- resource: 'pods',
799
- namespace: namespace,
800
- label: 'app=prover-broker'
801
- });
802
- await deleteResourceByLabel({
803
- resource: 'pods',
804
- namespace: namespace,
805
- label: 'app=prover-agent'
806
- });
807
- await deleteResourceByLabel({
808
- resource: 'pods',
809
- namespace: namespace,
810
- label: 'app=validator'
811
- });
812
- await deleteResourceByLabel({
813
- resource: 'pods',
814
- namespace: namespace,
815
- label: 'app=pxe'
816
- });
817
- await sleep(10 * 1000);
818
- await waitForResourceByLabel({
819
- resource: 'pods',
820
- namespace: namespace,
821
- label: 'app=boot-node'
822
- });
823
- await waitForResourceByLabel({
824
- resource: 'pods',
825
- namespace: namespace,
826
- label: 'app=prover-node'
827
- });
828
- await waitForResourceByLabel({
829
- resource: 'pods',
830
- namespace: namespace,
831
- label: 'app=prover-broker'
832
- });
833
- await waitForResourceByLabel({
834
- resource: 'pods',
835
- namespace: namespace,
836
- label: 'app=prover-agent'
837
- });
838
- await waitForResourceByLabel({
839
- resource: 'pods',
840
- namespace: namespace,
841
- label: 'app=validator'
842
- });
843
- await waitForResourceByLabel({
844
- resource: 'pods',
845
- namespace: namespace,
846
- label: 'app=pxe'
847
- });
848
- }
849
- /**
850
- * Returns the absolute path to the git repository root
851
- */ export function getGitProjectRoot() {
852
- try {
853
- const rootDir = execSync('git rev-parse --show-toplevel', {
854
- encoding: 'utf-8',
855
- stdio: [
856
- 'ignore',
857
- 'pipe',
858
- 'ignore'
859
- ]
860
- }).trim();
861
- return rootDir;
862
- } catch (error) {
863
- throw new Error(`Failed to determine git project root: ${error}`);
864
- }
865
- }
866
- /** Returns a client to the RPC of the given sequencer (defaults to first) */ export async function getNodeClient(env, index = 0) {
867
- const namespace = env.NAMESPACE;
868
- const containerPort = 8080;
869
- const sequencers = await getSequencers(namespace);
870
- const sequencer = sequencers[index];
871
- if (!sequencer) {
872
- throw new Error(`No sequencer found at index ${index} in namespace ${namespace}`);
873
- }
874
- const { process: process1, port } = await startPortForward({
875
- resource: `pod/${sequencer}`,
876
- namespace,
877
- containerPort
878
- });
879
- const url = `http://localhost:${port}`;
880
- await retry(()=>fetch(`${url}/status`).then((res)=>res.status === 200), 'forward port', makeBackoff([
881
- 1,
882
- 1,
883
- 2,
884
- 6
885
- ]), logger, true);
886
- const client = createAztecNodeClient(url);
887
- return {
888
- node: client,
889
- port,
890
- process: process1
891
- };
892
- }
1
+ export * from './utils/index.js';