@aztec/end-to-end 0.77.0-testnet-ignition.17 → 0.77.0-testnet-ignition.21
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.
- package/dest/spartan/utils.d.ts +6 -76
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +62 -44
- package/package.json +31 -31
- package/src/spartan/utils.ts +76 -54
package/dest/spartan/utils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
2
|
import type { RollupCheatCodes } from '@aztec/aztec.js/ethereum';
|
|
4
3
|
import type { Logger } from '@aztec/foundation/log';
|
|
5
4
|
import type { SequencerConfig } from '@aztec/sequencer-client';
|
|
5
|
+
import { ChildProcess } from 'child_process';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { type AlertConfig } from '../quality_of_service/alert_checker.js';
|
|
8
8
|
declare const k8sLocalConfigSchema: z.ZodObject<{
|
|
@@ -12,17 +12,11 @@ declare const k8sLocalConfigSchema: z.ZodObject<{
|
|
|
12
12
|
AZTEC_PROOF_SUBMISSION_WINDOW: z.ZodNumber;
|
|
13
13
|
INSTANCE_NAME: z.ZodString;
|
|
14
14
|
NAMESPACE: z.ZodString;
|
|
15
|
-
HOST_NODE_PORT: z.ZodNumber;
|
|
16
15
|
CONTAINER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
17
|
-
HOST_SEQUENCER_PORT: z.ZodNumber;
|
|
18
16
|
CONTAINER_SEQUENCER_PORT: z.ZodDefault<z.ZodNumber>;
|
|
19
|
-
HOST_PROVER_NODE_PORT: z.ZodNumber;
|
|
20
17
|
CONTAINER_PROVER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
21
|
-
HOST_PXE_PORT: z.ZodNumber;
|
|
22
18
|
CONTAINER_PXE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
23
|
-
HOST_ETHEREUM_PORT: z.ZodNumber;
|
|
24
19
|
CONTAINER_ETHEREUM_PORT: z.ZodDefault<z.ZodNumber>;
|
|
25
|
-
HOST_METRICS_PORT: z.ZodNumber;
|
|
26
20
|
CONTAINER_METRICS_PORT: z.ZodDefault<z.ZodNumber>;
|
|
27
21
|
GRAFANA_PASSWORD: z.ZodOptional<z.ZodString>;
|
|
28
22
|
METRICS_API_PATH: z.ZodDefault<z.ZodString>;
|
|
@@ -38,17 +32,11 @@ declare const k8sLocalConfigSchema: z.ZodObject<{
|
|
|
38
32
|
AZTEC_PROOF_SUBMISSION_WINDOW: number;
|
|
39
33
|
INSTANCE_NAME: string;
|
|
40
34
|
NAMESPACE: string;
|
|
41
|
-
HOST_NODE_PORT: number;
|
|
42
35
|
CONTAINER_NODE_PORT: number;
|
|
43
|
-
HOST_SEQUENCER_PORT: number;
|
|
44
36
|
CONTAINER_SEQUENCER_PORT: number;
|
|
45
|
-
HOST_PROVER_NODE_PORT: number;
|
|
46
37
|
CONTAINER_PROVER_NODE_PORT: number;
|
|
47
|
-
HOST_PXE_PORT: number;
|
|
48
38
|
CONTAINER_PXE_PORT: number;
|
|
49
|
-
HOST_ETHEREUM_PORT: number;
|
|
50
39
|
CONTAINER_ETHEREUM_PORT: number;
|
|
51
|
-
HOST_METRICS_PORT: number;
|
|
52
40
|
CONTAINER_METRICS_PORT: number;
|
|
53
41
|
METRICS_API_PATH: string;
|
|
54
42
|
SPARTAN_DIR: string;
|
|
@@ -64,12 +52,6 @@ declare const k8sLocalConfigSchema: z.ZodObject<{
|
|
|
64
52
|
AZTEC_PROOF_SUBMISSION_WINDOW: number;
|
|
65
53
|
INSTANCE_NAME: string;
|
|
66
54
|
NAMESPACE: string;
|
|
67
|
-
HOST_NODE_PORT: number;
|
|
68
|
-
HOST_SEQUENCER_PORT: number;
|
|
69
|
-
HOST_PROVER_NODE_PORT: number;
|
|
70
|
-
HOST_PXE_PORT: number;
|
|
71
|
-
HOST_ETHEREUM_PORT: number;
|
|
72
|
-
HOST_METRICS_PORT: number;
|
|
73
55
|
SPARTAN_DIR: string;
|
|
74
56
|
K8S: "local";
|
|
75
57
|
ETHEREUM_HOSTS?: string | undefined;
|
|
@@ -91,17 +73,11 @@ declare const k8sGCloudConfigSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
91
73
|
AZTEC_PROOF_SUBMISSION_WINDOW: z.ZodNumber;
|
|
92
74
|
INSTANCE_NAME: z.ZodString;
|
|
93
75
|
NAMESPACE: z.ZodString;
|
|
94
|
-
HOST_NODE_PORT: z.ZodNumber;
|
|
95
76
|
CONTAINER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
96
|
-
HOST_SEQUENCER_PORT: z.ZodNumber;
|
|
97
77
|
CONTAINER_SEQUENCER_PORT: z.ZodDefault<z.ZodNumber>;
|
|
98
|
-
HOST_PROVER_NODE_PORT: z.ZodNumber;
|
|
99
78
|
CONTAINER_PROVER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
100
|
-
HOST_PXE_PORT: z.ZodNumber;
|
|
101
79
|
CONTAINER_PXE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
102
|
-
HOST_ETHEREUM_PORT: z.ZodNumber;
|
|
103
80
|
CONTAINER_ETHEREUM_PORT: z.ZodDefault<z.ZodNumber>;
|
|
104
|
-
HOST_METRICS_PORT: z.ZodNumber;
|
|
105
81
|
CONTAINER_METRICS_PORT: z.ZodDefault<z.ZodNumber>;
|
|
106
82
|
GRAFANA_PASSWORD: z.ZodOptional<z.ZodString>;
|
|
107
83
|
METRICS_API_PATH: z.ZodDefault<z.ZodString>;
|
|
@@ -121,17 +97,11 @@ declare const k8sGCloudConfigSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
121
97
|
AZTEC_PROOF_SUBMISSION_WINDOW: number;
|
|
122
98
|
INSTANCE_NAME: string;
|
|
123
99
|
NAMESPACE: string;
|
|
124
|
-
HOST_NODE_PORT: number;
|
|
125
100
|
CONTAINER_NODE_PORT: number;
|
|
126
|
-
HOST_SEQUENCER_PORT: number;
|
|
127
101
|
CONTAINER_SEQUENCER_PORT: number;
|
|
128
|
-
HOST_PROVER_NODE_PORT: number;
|
|
129
102
|
CONTAINER_PROVER_NODE_PORT: number;
|
|
130
|
-
HOST_PXE_PORT: number;
|
|
131
103
|
CONTAINER_PXE_PORT: number;
|
|
132
|
-
HOST_ETHEREUM_PORT: number;
|
|
133
104
|
CONTAINER_ETHEREUM_PORT: number;
|
|
134
|
-
HOST_METRICS_PORT: number;
|
|
135
105
|
CONTAINER_METRICS_PORT: number;
|
|
136
106
|
METRICS_API_PATH: string;
|
|
137
107
|
SPARTAN_DIR: string;
|
|
@@ -149,12 +119,6 @@ declare const k8sGCloudConfigSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
149
119
|
AZTEC_PROOF_SUBMISSION_WINDOW: number;
|
|
150
120
|
INSTANCE_NAME: string;
|
|
151
121
|
NAMESPACE: string;
|
|
152
|
-
HOST_NODE_PORT: number;
|
|
153
|
-
HOST_SEQUENCER_PORT: number;
|
|
154
|
-
HOST_PROVER_NODE_PORT: number;
|
|
155
|
-
HOST_PXE_PORT: number;
|
|
156
|
-
HOST_ETHEREUM_PORT: number;
|
|
157
|
-
HOST_METRICS_PORT: number;
|
|
158
122
|
SPARTAN_DIR: string;
|
|
159
123
|
K8S: "gcloud";
|
|
160
124
|
CLUSTER_NAME: string;
|
|
@@ -194,17 +158,11 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
194
158
|
AZTEC_PROOF_SUBMISSION_WINDOW: z.ZodNumber;
|
|
195
159
|
INSTANCE_NAME: z.ZodString;
|
|
196
160
|
NAMESPACE: z.ZodString;
|
|
197
|
-
HOST_NODE_PORT: z.ZodNumber;
|
|
198
161
|
CONTAINER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
199
|
-
HOST_SEQUENCER_PORT: z.ZodNumber;
|
|
200
162
|
CONTAINER_SEQUENCER_PORT: z.ZodDefault<z.ZodNumber>;
|
|
201
|
-
HOST_PROVER_NODE_PORT: z.ZodNumber;
|
|
202
163
|
CONTAINER_PROVER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
203
|
-
HOST_PXE_PORT: z.ZodNumber;
|
|
204
164
|
CONTAINER_PXE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
205
|
-
HOST_ETHEREUM_PORT: z.ZodNumber;
|
|
206
165
|
CONTAINER_ETHEREUM_PORT: z.ZodDefault<z.ZodNumber>;
|
|
207
|
-
HOST_METRICS_PORT: z.ZodNumber;
|
|
208
166
|
CONTAINER_METRICS_PORT: z.ZodDefault<z.ZodNumber>;
|
|
209
167
|
GRAFANA_PASSWORD: z.ZodOptional<z.ZodString>;
|
|
210
168
|
METRICS_API_PATH: z.ZodDefault<z.ZodString>;
|
|
@@ -220,17 +178,11 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
220
178
|
AZTEC_PROOF_SUBMISSION_WINDOW: number;
|
|
221
179
|
INSTANCE_NAME: string;
|
|
222
180
|
NAMESPACE: string;
|
|
223
|
-
HOST_NODE_PORT: number;
|
|
224
181
|
CONTAINER_NODE_PORT: number;
|
|
225
|
-
HOST_SEQUENCER_PORT: number;
|
|
226
182
|
CONTAINER_SEQUENCER_PORT: number;
|
|
227
|
-
HOST_PROVER_NODE_PORT: number;
|
|
228
183
|
CONTAINER_PROVER_NODE_PORT: number;
|
|
229
|
-
HOST_PXE_PORT: number;
|
|
230
184
|
CONTAINER_PXE_PORT: number;
|
|
231
|
-
HOST_ETHEREUM_PORT: number;
|
|
232
185
|
CONTAINER_ETHEREUM_PORT: number;
|
|
233
|
-
HOST_METRICS_PORT: number;
|
|
234
186
|
CONTAINER_METRICS_PORT: number;
|
|
235
187
|
METRICS_API_PATH: string;
|
|
236
188
|
SPARTAN_DIR: string;
|
|
@@ -246,12 +198,6 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
246
198
|
AZTEC_PROOF_SUBMISSION_WINDOW: number;
|
|
247
199
|
INSTANCE_NAME: string;
|
|
248
200
|
NAMESPACE: string;
|
|
249
|
-
HOST_NODE_PORT: number;
|
|
250
|
-
HOST_SEQUENCER_PORT: number;
|
|
251
|
-
HOST_PROVER_NODE_PORT: number;
|
|
252
|
-
HOST_PXE_PORT: number;
|
|
253
|
-
HOST_ETHEREUM_PORT: number;
|
|
254
|
-
HOST_METRICS_PORT: number;
|
|
255
201
|
SPARTAN_DIR: string;
|
|
256
202
|
K8S: "local";
|
|
257
203
|
ETHEREUM_HOSTS?: string | undefined;
|
|
@@ -272,17 +218,11 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
272
218
|
AZTEC_PROOF_SUBMISSION_WINDOW: z.ZodNumber;
|
|
273
219
|
INSTANCE_NAME: z.ZodString;
|
|
274
220
|
NAMESPACE: z.ZodString;
|
|
275
|
-
HOST_NODE_PORT: z.ZodNumber;
|
|
276
221
|
CONTAINER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
277
|
-
HOST_SEQUENCER_PORT: z.ZodNumber;
|
|
278
222
|
CONTAINER_SEQUENCER_PORT: z.ZodDefault<z.ZodNumber>;
|
|
279
|
-
HOST_PROVER_NODE_PORT: z.ZodNumber;
|
|
280
223
|
CONTAINER_PROVER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
281
|
-
HOST_PXE_PORT: z.ZodNumber;
|
|
282
224
|
CONTAINER_PXE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
283
|
-
HOST_ETHEREUM_PORT: z.ZodNumber;
|
|
284
225
|
CONTAINER_ETHEREUM_PORT: z.ZodDefault<z.ZodNumber>;
|
|
285
|
-
HOST_METRICS_PORT: z.ZodNumber;
|
|
286
226
|
CONTAINER_METRICS_PORT: z.ZodDefault<z.ZodNumber>;
|
|
287
227
|
GRAFANA_PASSWORD: z.ZodOptional<z.ZodString>;
|
|
288
228
|
METRICS_API_PATH: z.ZodDefault<z.ZodString>;
|
|
@@ -302,17 +242,11 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
302
242
|
AZTEC_PROOF_SUBMISSION_WINDOW: number;
|
|
303
243
|
INSTANCE_NAME: string;
|
|
304
244
|
NAMESPACE: string;
|
|
305
|
-
HOST_NODE_PORT: number;
|
|
306
245
|
CONTAINER_NODE_PORT: number;
|
|
307
|
-
HOST_SEQUENCER_PORT: number;
|
|
308
246
|
CONTAINER_SEQUENCER_PORT: number;
|
|
309
|
-
HOST_PROVER_NODE_PORT: number;
|
|
310
247
|
CONTAINER_PROVER_NODE_PORT: number;
|
|
311
|
-
HOST_PXE_PORT: number;
|
|
312
248
|
CONTAINER_PXE_PORT: number;
|
|
313
|
-
HOST_ETHEREUM_PORT: number;
|
|
314
249
|
CONTAINER_ETHEREUM_PORT: number;
|
|
315
|
-
HOST_METRICS_PORT: number;
|
|
316
250
|
CONTAINER_METRICS_PORT: number;
|
|
317
251
|
METRICS_API_PATH: string;
|
|
318
252
|
SPARTAN_DIR: string;
|
|
@@ -330,12 +264,6 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
330
264
|
AZTEC_PROOF_SUBMISSION_WINDOW: number;
|
|
331
265
|
INSTANCE_NAME: string;
|
|
332
266
|
NAMESPACE: string;
|
|
333
|
-
HOST_NODE_PORT: number;
|
|
334
|
-
HOST_SEQUENCER_PORT: number;
|
|
335
|
-
HOST_PROVER_NODE_PORT: number;
|
|
336
|
-
HOST_PXE_PORT: number;
|
|
337
|
-
HOST_ETHEREUM_PORT: number;
|
|
338
|
-
HOST_METRICS_PORT: number;
|
|
339
267
|
SPARTAN_DIR: string;
|
|
340
268
|
K8S: "gcloud";
|
|
341
269
|
CLUSTER_NAME: string;
|
|
@@ -378,8 +306,11 @@ export declare function startPortForward({ resource, namespace, containerPort, h
|
|
|
378
306
|
resource: string;
|
|
379
307
|
namespace: string;
|
|
380
308
|
containerPort: number;
|
|
381
|
-
hostPort
|
|
382
|
-
}): Promise<
|
|
309
|
+
hostPort?: number;
|
|
310
|
+
}): Promise<{
|
|
311
|
+
process: ChildProcess;
|
|
312
|
+
port: number;
|
|
313
|
+
}>;
|
|
383
314
|
export declare function deleteResourceByName({ resource, namespace, name, force, }: {
|
|
384
315
|
resource: string;
|
|
385
316
|
namespace: string;
|
|
@@ -468,7 +399,6 @@ export declare function updateSequencerConfig(url: string, config: Partial<Seque
|
|
|
468
399
|
export declare function getSequencers(namespace: string): Promise<string[]>;
|
|
469
400
|
export declare function updateK8sSequencersConfig(args: {
|
|
470
401
|
containerPort: number;
|
|
471
|
-
hostPort: number;
|
|
472
402
|
namespace: string;
|
|
473
403
|
config: Partial<SequencerConfig>;
|
|
474
404
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/spartan/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/spartan/utils.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAyB,MAAM,eAAe,CAAC;AAGpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAmBxF,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBxB,CAAC;AAEH,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;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WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,iBAef;AAED,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,iBAMjE;AAED,wBAAsB,8BAA8B,CAClD,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,iBAgBf;AAED,wBAAsB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,MAAM,iBAgB3F;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,iBAGxF;AAED,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,qBAIpD;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAClC,iBAcA;AAED,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,iBAU5F;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,iBAcpD"}
|
package/dest/spartan/utils.js
CHANGED
|
@@ -21,17 +21,11 @@ const k8sLocalConfigSchema = z.object({
|
|
|
21
21
|
AZTEC_PROOF_SUBMISSION_WINDOW: z.coerce.number().min(1, 'AZTEC_PROOF_SUBMISSION_WINDOW env variable must be set'),
|
|
22
22
|
INSTANCE_NAME: z.string().min(1, 'INSTANCE_NAME env variable must be set'),
|
|
23
23
|
NAMESPACE: z.string().min(1, 'NAMESPACE env variable must be set'),
|
|
24
|
-
HOST_NODE_PORT: z.coerce.number().min(1, 'HOST_NODE_PORT env variable must be set'),
|
|
25
24
|
CONTAINER_NODE_PORT: z.coerce.number().default(8080),
|
|
26
|
-
HOST_SEQUENCER_PORT: z.coerce.number().min(1, 'HOST_SEQUENCER_PORT env variable must be set'),
|
|
27
25
|
CONTAINER_SEQUENCER_PORT: z.coerce.number().default(8080),
|
|
28
|
-
HOST_PROVER_NODE_PORT: z.coerce.number().min(1, 'HOST_PROVER_NODE_PORT env variable must be set'),
|
|
29
26
|
CONTAINER_PROVER_NODE_PORT: z.coerce.number().default(8080),
|
|
30
|
-
HOST_PXE_PORT: z.coerce.number().min(1, 'HOST_PXE_PORT env variable must be set'),
|
|
31
27
|
CONTAINER_PXE_PORT: z.coerce.number().default(8080),
|
|
32
|
-
HOST_ETHEREUM_PORT: z.coerce.number().min(1, 'HOST_ETHEREUM_PORT env variable must be set'),
|
|
33
28
|
CONTAINER_ETHEREUM_PORT: z.coerce.number().default(8545),
|
|
34
|
-
HOST_METRICS_PORT: z.coerce.number().min(1, 'HOST_METRICS_PORT env variable must be set'),
|
|
35
29
|
CONTAINER_METRICS_PORT: z.coerce.number().default(80),
|
|
36
30
|
GRAFANA_PASSWORD: z.string().optional(),
|
|
37
31
|
METRICS_API_PATH: z.string().default('/api/datasources/proxy/uid/spartan-metrics-prometheus/api/v1'),
|
|
@@ -72,25 +66,14 @@ export function setupEnvironment(env) {
|
|
|
72
66
|
return config;
|
|
73
67
|
}
|
|
74
68
|
export async function startPortForward({ resource, namespace, containerPort, hostPort }) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const command = `ps aux | grep 'kubectl.*${hostPort}:${containerPort}' | grep -v grep | awk '{print $2}'`;
|
|
78
|
-
const { stdout: processId } = await execAsync(command);
|
|
79
|
-
if (processId) {
|
|
80
|
-
logger.info(`Restarting port forward for ${resource}:${hostPort}`);
|
|
81
|
-
// kill the existing port forward
|
|
82
|
-
await execAsync(`kill -9 ${processId}`);
|
|
83
|
-
}
|
|
84
|
-
} catch (e) {
|
|
85
|
-
logger.info(`No existing port forward found for ${resource}:${hostPort}`);
|
|
86
|
-
}
|
|
87
|
-
logger.info(`kubectl port-forward -n ${namespace} ${resource} ${hostPort}:${containerPort}`);
|
|
69
|
+
const hostPortAsString = hostPort ? hostPort.toString() : '';
|
|
70
|
+
logger.info(`kubectl port-forward -n ${namespace} ${resource} ${hostPortAsString}:${containerPort}`);
|
|
88
71
|
const process = spawn('kubectl', [
|
|
89
72
|
'port-forward',
|
|
90
73
|
'-n',
|
|
91
74
|
namespace,
|
|
92
75
|
resource,
|
|
93
|
-
`${
|
|
76
|
+
`${hostPortAsString}:${containerPort}`
|
|
94
77
|
], {
|
|
95
78
|
detached: true,
|
|
96
79
|
windowsHide: true,
|
|
@@ -100,24 +83,54 @@ export async function startPortForward({ resource, namespace, containerPort, hos
|
|
|
100
83
|
'pipe'
|
|
101
84
|
]
|
|
102
85
|
});
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
86
|
+
let isResolved = false;
|
|
87
|
+
const connected = new Promise((resolve)=>{
|
|
88
|
+
process.stdout?.on('data', (data)=>{
|
|
89
|
+
const str = data.toString();
|
|
90
|
+
if (!isResolved && str.includes('Forwarding from')) {
|
|
91
|
+
isResolved = true;
|
|
92
|
+
logger.info(str);
|
|
93
|
+
const port = str.search(/:\d+/);
|
|
94
|
+
if (port === -1) {
|
|
95
|
+
throw new Error('Port not found in port forward output');
|
|
96
|
+
}
|
|
97
|
+
const portNumber = parseInt(str.slice(port + 1));
|
|
98
|
+
logger.info(`Port forward connected: ${portNumber}`);
|
|
99
|
+
logger.info(`Port forward connected: ${portNumber}`);
|
|
100
|
+
resolve(portNumber);
|
|
101
|
+
} else {
|
|
102
|
+
logger.silent(str);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
process.stderr?.on('data', (data)=>{
|
|
106
|
+
logger.info(data.toString());
|
|
107
|
+
// It's a strange thing:
|
|
108
|
+
// If we don't pipe stderr, then the port forwarding does not work.
|
|
109
|
+
// Log to silent because this doesn't actually report errors,
|
|
110
|
+
// just extremely verbose debug logs.
|
|
111
|
+
logger.silent(data.toString());
|
|
112
|
+
});
|
|
113
|
+
process.on('close', ()=>{
|
|
114
|
+
if (!isResolved) {
|
|
115
|
+
isResolved = true;
|
|
116
|
+
logger.warn('Port forward closed before connection established');
|
|
117
|
+
resolve(0);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
process.on('error', (error)=>{
|
|
121
|
+
logger.error(`Port forward error: ${error}`);
|
|
122
|
+
resolve(0);
|
|
123
|
+
});
|
|
124
|
+
process.on('exit', (code)=>{
|
|
125
|
+
logger.info(`Port forward exited with code ${code}`);
|
|
126
|
+
resolve(0);
|
|
127
|
+
});
|
|
117
128
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
const port = await connected;
|
|
130
|
+
return {
|
|
131
|
+
process,
|
|
132
|
+
port
|
|
133
|
+
};
|
|
121
134
|
}
|
|
122
135
|
export async function deleteResourceByName({ resource, namespace, name, force = false }) {
|
|
123
136
|
const command = `kubectl delete ${resource} ${name} -n ${namespace} --ignore-not-found=true --wait=true ${force ? '--force' : ''}`;
|
|
@@ -312,11 +325,17 @@ export async function enableValidatorDynamicBootNode(instanceName, namespace, sp
|
|
|
312
325
|
}
|
|
313
326
|
export async function runAlertCheck(config, alerts, logger) {
|
|
314
327
|
if (isK8sConfig(config)) {
|
|
328
|
+
const { process, port } = await startPortForward({
|
|
329
|
+
resource: `svc/metrics-grafana`,
|
|
330
|
+
namespace: 'metrics',
|
|
331
|
+
containerPort: config.CONTAINER_METRICS_PORT
|
|
332
|
+
});
|
|
315
333
|
const alertChecker = new AlertChecker(logger, {
|
|
316
|
-
grafanaEndpoint: `http://localhost:${
|
|
334
|
+
grafanaEndpoint: `http://localhost:${port}${config.METRICS_API_PATH}`,
|
|
317
335
|
grafanaCredentials: `admin:${config.GRAFANA_PASSWORD}`
|
|
318
336
|
});
|
|
319
337
|
await alertChecker.runAlertCheck(alerts);
|
|
338
|
+
process.kill();
|
|
320
339
|
} else {
|
|
321
340
|
logger.info('Not running alert check in non-k8s environment');
|
|
322
341
|
}
|
|
@@ -331,24 +350,23 @@ export async function getSequencers(namespace) {
|
|
|
331
350
|
return stdout.split(' ');
|
|
332
351
|
}
|
|
333
352
|
export async function updateK8sSequencersConfig(args) {
|
|
334
|
-
const { containerPort,
|
|
353
|
+
const { containerPort, namespace, config } = args;
|
|
335
354
|
const sequencers = await getSequencers(namespace);
|
|
336
355
|
for (const sequencer of sequencers){
|
|
337
|
-
await startPortForward({
|
|
356
|
+
const { process, port } = await startPortForward({
|
|
338
357
|
resource: `pod/${sequencer}`,
|
|
339
358
|
namespace,
|
|
340
|
-
containerPort
|
|
341
|
-
hostPort
|
|
359
|
+
containerPort
|
|
342
360
|
});
|
|
343
|
-
const url = `http://localhost:${
|
|
361
|
+
const url = `http://localhost:${port}`;
|
|
344
362
|
await updateSequencerConfig(url, config);
|
|
363
|
+
process.kill();
|
|
345
364
|
}
|
|
346
365
|
}
|
|
347
366
|
export async function updateSequencersConfig(env, config) {
|
|
348
367
|
if (isK8sConfig(env)) {
|
|
349
368
|
await updateK8sSequencersConfig({
|
|
350
369
|
containerPort: env.CONTAINER_NODE_PORT,
|
|
351
|
-
hostPort: env.HOST_NODE_PORT,
|
|
352
370
|
namespace: env.NAMESPACE,
|
|
353
371
|
config
|
|
354
372
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "0.77.0-testnet-ignition.
|
|
3
|
+
"version": "0.77.0-testnet-ignition.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -26,36 +26,36 @@
|
|
|
26
26
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aztec/accounts": "0.77.0-testnet-ignition.
|
|
30
|
-
"@aztec/archiver": "0.77.0-testnet-ignition.
|
|
31
|
-
"@aztec/aztec": "0.77.0-testnet-ignition.
|
|
32
|
-
"@aztec/aztec-node": "0.77.0-testnet-ignition.
|
|
33
|
-
"@aztec/aztec.js": "0.77.0-testnet-ignition.
|
|
34
|
-
"@aztec/bb-prover": "0.77.0-testnet-ignition.
|
|
35
|
-
"@aztec/blob-lib": "0.77.0-testnet-ignition.
|
|
36
|
-
"@aztec/blob-sink": "0.77.0-testnet-ignition.
|
|
37
|
-
"@aztec/bot": "0.77.0-testnet-ignition.
|
|
38
|
-
"@aztec/constants": "0.77.0-testnet-ignition.
|
|
39
|
-
"@aztec/entrypoints": "0.77.0-testnet-ignition.
|
|
40
|
-
"@aztec/epoch-cache": "0.77.0-testnet-ignition.
|
|
41
|
-
"@aztec/ethereum": "0.77.0-testnet-ignition.
|
|
42
|
-
"@aztec/foundation": "0.77.0-testnet-ignition.
|
|
43
|
-
"@aztec/kv-store": "0.77.0-testnet-ignition.
|
|
44
|
-
"@aztec/l1-artifacts": "0.77.0-testnet-ignition.
|
|
45
|
-
"@aztec/merkle-tree": "0.77.0-testnet-ignition.
|
|
46
|
-
"@aztec/noir-contracts.js": "0.77.0-testnet-ignition.
|
|
47
|
-
"@aztec/noir-protocol-circuits-types": "0.77.0-testnet-ignition.
|
|
48
|
-
"@aztec/p2p": "0.77.0-testnet-ignition.
|
|
49
|
-
"@aztec/protocol-contracts": "0.77.0-testnet-ignition.
|
|
50
|
-
"@aztec/prover-client": "0.77.0-testnet-ignition.
|
|
51
|
-
"@aztec/prover-node": "0.77.0-testnet-ignition.
|
|
52
|
-
"@aztec/pxe": "0.77.0-testnet-ignition.
|
|
53
|
-
"@aztec/sequencer-client": "0.77.0-testnet-ignition.
|
|
54
|
-
"@aztec/simulator": "0.77.0-testnet-ignition.
|
|
55
|
-
"@aztec/stdlib": "0.77.0-testnet-ignition.
|
|
56
|
-
"@aztec/telemetry-client": "0.77.0-testnet-ignition.
|
|
57
|
-
"@aztec/validator-client": "0.77.0-testnet-ignition.
|
|
58
|
-
"@aztec/world-state": "0.77.0-testnet-ignition.
|
|
29
|
+
"@aztec/accounts": "0.77.0-testnet-ignition.21",
|
|
30
|
+
"@aztec/archiver": "0.77.0-testnet-ignition.21",
|
|
31
|
+
"@aztec/aztec": "0.77.0-testnet-ignition.21",
|
|
32
|
+
"@aztec/aztec-node": "0.77.0-testnet-ignition.21",
|
|
33
|
+
"@aztec/aztec.js": "0.77.0-testnet-ignition.21",
|
|
34
|
+
"@aztec/bb-prover": "0.77.0-testnet-ignition.21",
|
|
35
|
+
"@aztec/blob-lib": "0.77.0-testnet-ignition.21",
|
|
36
|
+
"@aztec/blob-sink": "0.77.0-testnet-ignition.21",
|
|
37
|
+
"@aztec/bot": "0.77.0-testnet-ignition.21",
|
|
38
|
+
"@aztec/constants": "0.77.0-testnet-ignition.21",
|
|
39
|
+
"@aztec/entrypoints": "0.77.0-testnet-ignition.21",
|
|
40
|
+
"@aztec/epoch-cache": "0.77.0-testnet-ignition.21",
|
|
41
|
+
"@aztec/ethereum": "0.77.0-testnet-ignition.21",
|
|
42
|
+
"@aztec/foundation": "0.77.0-testnet-ignition.21",
|
|
43
|
+
"@aztec/kv-store": "0.77.0-testnet-ignition.21",
|
|
44
|
+
"@aztec/l1-artifacts": "0.77.0-testnet-ignition.21",
|
|
45
|
+
"@aztec/merkle-tree": "0.77.0-testnet-ignition.21",
|
|
46
|
+
"@aztec/noir-contracts.js": "0.77.0-testnet-ignition.21",
|
|
47
|
+
"@aztec/noir-protocol-circuits-types": "0.77.0-testnet-ignition.21",
|
|
48
|
+
"@aztec/p2p": "0.77.0-testnet-ignition.21",
|
|
49
|
+
"@aztec/protocol-contracts": "0.77.0-testnet-ignition.21",
|
|
50
|
+
"@aztec/prover-client": "0.77.0-testnet-ignition.21",
|
|
51
|
+
"@aztec/prover-node": "0.77.0-testnet-ignition.21",
|
|
52
|
+
"@aztec/pxe": "0.77.0-testnet-ignition.21",
|
|
53
|
+
"@aztec/sequencer-client": "0.77.0-testnet-ignition.21",
|
|
54
|
+
"@aztec/simulator": "0.77.0-testnet-ignition.21",
|
|
55
|
+
"@aztec/stdlib": "0.77.0-testnet-ignition.21",
|
|
56
|
+
"@aztec/telemetry-client": "0.77.0-testnet-ignition.21",
|
|
57
|
+
"@aztec/validator-client": "0.77.0-testnet-ignition.21",
|
|
58
|
+
"@aztec/world-state": "0.77.0-testnet-ignition.21",
|
|
59
59
|
"@iarna/toml": "^2.2.5",
|
|
60
60
|
"@jest/globals": "^29.5.0",
|
|
61
61
|
"@noble/curves": "^1.0.0",
|
package/src/spartan/utils.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { RollupCheatCodes } from '@aztec/aztec.js/ethereum';
|
|
|
3
3
|
import type { Logger } from '@aztec/foundation/log';
|
|
4
4
|
import type { SequencerConfig } from '@aztec/sequencer-client';
|
|
5
5
|
|
|
6
|
-
import { exec, execSync, spawn } from 'child_process';
|
|
6
|
+
import { ChildProcess, exec, execSync, spawn } from 'child_process';
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import { promisify } from 'util';
|
|
9
9
|
import { z } from 'zod';
|
|
@@ -34,17 +34,11 @@ const k8sLocalConfigSchema = z.object({
|
|
|
34
34
|
AZTEC_PROOF_SUBMISSION_WINDOW: z.coerce.number().min(1, 'AZTEC_PROOF_SUBMISSION_WINDOW env variable must be set'),
|
|
35
35
|
INSTANCE_NAME: z.string().min(1, 'INSTANCE_NAME env variable must be set'),
|
|
36
36
|
NAMESPACE: z.string().min(1, 'NAMESPACE env variable must be set'),
|
|
37
|
-
HOST_NODE_PORT: z.coerce.number().min(1, 'HOST_NODE_PORT env variable must be set'),
|
|
38
37
|
CONTAINER_NODE_PORT: z.coerce.number().default(8080),
|
|
39
|
-
HOST_SEQUENCER_PORT: z.coerce.number().min(1, 'HOST_SEQUENCER_PORT env variable must be set'),
|
|
40
38
|
CONTAINER_SEQUENCER_PORT: z.coerce.number().default(8080),
|
|
41
|
-
HOST_PROVER_NODE_PORT: z.coerce.number().min(1, 'HOST_PROVER_NODE_PORT env variable must be set'),
|
|
42
39
|
CONTAINER_PROVER_NODE_PORT: z.coerce.number().default(8080),
|
|
43
|
-
HOST_PXE_PORT: z.coerce.number().min(1, 'HOST_PXE_PORT env variable must be set'),
|
|
44
40
|
CONTAINER_PXE_PORT: z.coerce.number().default(8080),
|
|
45
|
-
HOST_ETHEREUM_PORT: z.coerce.number().min(1, 'HOST_ETHEREUM_PORT env variable must be set'),
|
|
46
41
|
CONTAINER_ETHEREUM_PORT: z.coerce.number().default(8545),
|
|
47
|
-
HOST_METRICS_PORT: z.coerce.number().min(1, 'HOST_METRICS_PORT env variable must be set'),
|
|
48
42
|
CONTAINER_METRICS_PORT: z.coerce.number().default(80),
|
|
49
43
|
GRAFANA_PASSWORD: z.string().optional(),
|
|
50
44
|
METRICS_API_PATH: z.string().default('/api/datasources/proxy/uid/spartan-metrics-prometheus/api/v1'),
|
|
@@ -101,49 +95,73 @@ export async function startPortForward({
|
|
|
101
95
|
resource: string;
|
|
102
96
|
namespace: string;
|
|
103
97
|
containerPort: number;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
98
|
+
// If not provided, the port will be chosen automatically
|
|
99
|
+
hostPort?: number;
|
|
100
|
+
}): Promise<{
|
|
101
|
+
process: ChildProcess;
|
|
102
|
+
port: number;
|
|
103
|
+
}> {
|
|
104
|
+
const hostPortAsString = hostPort ? hostPort.toString() : '';
|
|
105
|
+
|
|
106
|
+
logger.info(`kubectl port-forward -n ${namespace} ${resource} ${hostPortAsString}:${containerPort}`);
|
|
107
|
+
|
|
108
|
+
const process = spawn(
|
|
109
|
+
'kubectl',
|
|
110
|
+
['port-forward', '-n', namespace, resource, `${hostPortAsString}:${containerPort}`],
|
|
111
|
+
{
|
|
112
|
+
detached: true,
|
|
113
|
+
windowsHide: true,
|
|
114
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
115
|
+
},
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
let isResolved = false;
|
|
119
|
+
const connected = new Promise<number>(resolve => {
|
|
120
|
+
process.stdout?.on('data', data => {
|
|
121
|
+
const str = data.toString() as string;
|
|
122
|
+
if (!isResolved && str.includes('Forwarding from')) {
|
|
123
|
+
isResolved = true;
|
|
124
|
+
logger.info(str);
|
|
125
|
+
const port = str.search(/:\d+/);
|
|
126
|
+
if (port === -1) {
|
|
127
|
+
throw new Error('Port not found in port forward output');
|
|
128
|
+
}
|
|
129
|
+
const portNumber = parseInt(str.slice(port + 1));
|
|
130
|
+
logger.info(`Port forward connected: ${portNumber}`);
|
|
131
|
+
logger.info(`Port forward connected: ${portNumber}`);
|
|
132
|
+
resolve(portNumber);
|
|
133
|
+
} else {
|
|
134
|
+
logger.silent(str);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
process.stderr?.on('data', data => {
|
|
138
|
+
logger.info(data.toString());
|
|
139
|
+
// It's a strange thing:
|
|
140
|
+
// If we don't pipe stderr, then the port forwarding does not work.
|
|
141
|
+
// Log to silent because this doesn't actually report errors,
|
|
142
|
+
// just extremely verbose debug logs.
|
|
143
|
+
logger.silent(data.toString());
|
|
144
|
+
});
|
|
145
|
+
process.on('close', () => {
|
|
146
|
+
if (!isResolved) {
|
|
147
|
+
isResolved = true;
|
|
148
|
+
logger.warn('Port forward closed before connection established');
|
|
149
|
+
resolve(0);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
process.on('error', error => {
|
|
153
|
+
logger.error(`Port forward error: ${error}`);
|
|
154
|
+
resolve(0);
|
|
155
|
+
});
|
|
156
|
+
process.on('exit', code => {
|
|
157
|
+
logger.info(`Port forward exited with code ${code}`);
|
|
158
|
+
resolve(0);
|
|
159
|
+
});
|
|
141
160
|
});
|
|
142
161
|
|
|
143
|
-
|
|
144
|
-
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
162
|
+
const port = await connected;
|
|
145
163
|
|
|
146
|
-
return process;
|
|
164
|
+
return { process, port };
|
|
147
165
|
}
|
|
148
166
|
|
|
149
167
|
export async function deleteResourceByName({
|
|
@@ -481,11 +499,17 @@ export async function enableValidatorDynamicBootNode(
|
|
|
481
499
|
|
|
482
500
|
export async function runAlertCheck(config: EnvConfig, alerts: AlertConfig[], logger: Logger) {
|
|
483
501
|
if (isK8sConfig(config)) {
|
|
502
|
+
const { process, port } = await startPortForward({
|
|
503
|
+
resource: `svc/metrics-grafana`,
|
|
504
|
+
namespace: 'metrics',
|
|
505
|
+
containerPort: config.CONTAINER_METRICS_PORT,
|
|
506
|
+
});
|
|
484
507
|
const alertChecker = new AlertChecker(logger, {
|
|
485
|
-
grafanaEndpoint: `http://localhost:${
|
|
508
|
+
grafanaEndpoint: `http://localhost:${port}${config.METRICS_API_PATH}`,
|
|
486
509
|
grafanaCredentials: `admin:${config.GRAFANA_PASSWORD}`,
|
|
487
510
|
});
|
|
488
511
|
await alertChecker.runAlertCheck(alerts);
|
|
512
|
+
process.kill();
|
|
489
513
|
} else {
|
|
490
514
|
logger.info('Not running alert check in non-k8s environment');
|
|
491
515
|
}
|
|
@@ -504,22 +528,21 @@ export async function getSequencers(namespace: string) {
|
|
|
504
528
|
|
|
505
529
|
export async function updateK8sSequencersConfig(args: {
|
|
506
530
|
containerPort: number;
|
|
507
|
-
hostPort: number;
|
|
508
531
|
namespace: string;
|
|
509
532
|
config: Partial<SequencerConfig>;
|
|
510
533
|
}) {
|
|
511
|
-
const { containerPort,
|
|
534
|
+
const { containerPort, namespace, config } = args;
|
|
512
535
|
const sequencers = await getSequencers(namespace);
|
|
513
536
|
for (const sequencer of sequencers) {
|
|
514
|
-
await startPortForward({
|
|
537
|
+
const { process, port } = await startPortForward({
|
|
515
538
|
resource: `pod/${sequencer}`,
|
|
516
539
|
namespace,
|
|
517
540
|
containerPort,
|
|
518
|
-
hostPort,
|
|
519
541
|
});
|
|
520
542
|
|
|
521
|
-
const url = `http://localhost:${
|
|
543
|
+
const url = `http://localhost:${port}`;
|
|
522
544
|
await updateSequencerConfig(url, config);
|
|
545
|
+
process.kill();
|
|
523
546
|
}
|
|
524
547
|
}
|
|
525
548
|
|
|
@@ -527,7 +550,6 @@ export async function updateSequencersConfig(env: EnvConfig, config: Partial<Seq
|
|
|
527
550
|
if (isK8sConfig(env)) {
|
|
528
551
|
await updateK8sSequencersConfig({
|
|
529
552
|
containerPort: env.CONTAINER_NODE_PORT,
|
|
530
|
-
hostPort: env.HOST_NODE_PORT,
|
|
531
553
|
namespace: env.NAMESPACE,
|
|
532
554
|
config,
|
|
533
555
|
});
|