@aztec/end-to-end 0.79.0 → 0.80.0
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/sample-dapp/deploy.js +1 -0
- package/dest/spartan/utils.d.ts +14 -0
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +75 -12
- package/package.json +31 -31
- package/src/sample-dapp/deploy.mjs +2 -0
- package/src/spartan/utils.ts +59 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { getInitialTestAccountsWallets } from '@aztec/accounts/testing';
|
|
3
3
|
import { Contract, createPXEClient, waitForPXE } from '@aztec/aztec.js';
|
|
4
4
|
// docs:end:deploy-imports
|
|
5
|
+
// docs:start:import_artifact
|
|
5
6
|
import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
|
|
6
7
|
import { writeFileSync } from 'fs';
|
|
7
8
|
import { fileURLToPath } from 'url';
|
package/dest/spartan/utils.d.ts
CHANGED
|
@@ -302,6 +302,16 @@ export type EnvConfig = z.infer<typeof envSchema>;
|
|
|
302
302
|
export declare function isK8sConfig(config: EnvConfig): config is K8sLocalConfig | K8sGCloudConfig;
|
|
303
303
|
export declare function isGCloudConfig(config: EnvConfig): config is K8sGCloudConfig;
|
|
304
304
|
export declare function setupEnvironment(env: unknown): EnvConfig;
|
|
305
|
+
export declare function getAztecBin(): string;
|
|
306
|
+
/**
|
|
307
|
+
* Runs the Aztec binary
|
|
308
|
+
* @param args - The arguments to pass to the Aztec binary
|
|
309
|
+
* @param logger - The logger to use
|
|
310
|
+
* @param env - Optional environment variables to set for the process
|
|
311
|
+
* @returns The exit code of the Aztec binary
|
|
312
|
+
*/
|
|
313
|
+
export declare function runAztecBin(args: string[], logger: Logger, env?: Record<string, string>): Promise<number>;
|
|
314
|
+
export declare function runProjectScript(script: string, args: string[], logger: Logger, env?: Record<string, string>): Promise<number>;
|
|
305
315
|
export declare function startPortForward({ resource, namespace, containerPort, hostPort, }: {
|
|
306
316
|
resource: string;
|
|
307
317
|
namespace: string;
|
|
@@ -411,5 +421,9 @@ export declare function updateSequencersConfig(env: EnvConfig, config: Partial<S
|
|
|
411
421
|
* This is useful for testing, but you should be aware of the implications.
|
|
412
422
|
*/
|
|
413
423
|
export declare function rollAztecPods(namespace: string): Promise<void>;
|
|
424
|
+
/**
|
|
425
|
+
* Returns the absolute path to the git repository root
|
|
426
|
+
*/
|
|
427
|
+
export declare function getGitProjectRoot(): string;
|
|
414
428
|
export {};
|
|
415
429
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/spartan/utils.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIzB,CAAC;AAEH,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;EAKtB,CAAC;AAEH,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AM,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;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAW1C"}
|
package/dest/spartan/utils.js
CHANGED
|
@@ -65,10 +65,57 @@ export function setupEnvironment(env) {
|
|
|
65
65
|
}
|
|
66
66
|
return config;
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* @param path - The path to the script, relative to the project root
|
|
70
|
+
* @param args - The arguments to pass to the script
|
|
71
|
+
* @param logger - The logger to use
|
|
72
|
+
* @returns The exit code of the script
|
|
73
|
+
*/ function runScript(path, args, logger, env) {
|
|
74
|
+
const childProcess = spawn(path, args, {
|
|
75
|
+
stdio: [
|
|
76
|
+
'ignore',
|
|
77
|
+
'pipe',
|
|
78
|
+
'pipe'
|
|
79
|
+
],
|
|
80
|
+
env: env ? {
|
|
81
|
+
...process.env,
|
|
82
|
+
...env
|
|
83
|
+
} : process.env
|
|
84
|
+
});
|
|
85
|
+
return new Promise((resolve, reject)=>{
|
|
86
|
+
childProcess.on('close', (code)=>resolve(code ?? 0));
|
|
87
|
+
childProcess.on('error', reject);
|
|
88
|
+
childProcess.stdout?.on('data', (data)=>{
|
|
89
|
+
logger.info(data.toString());
|
|
90
|
+
});
|
|
91
|
+
childProcess.stderr?.on('data', (data)=>{
|
|
92
|
+
logger.error(data.toString());
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
export function getAztecBin() {
|
|
97
|
+
return path.join(getGitProjectRoot(), 'yarn-project/aztec/dest/bin/index.js');
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Runs the Aztec binary
|
|
101
|
+
* @param args - The arguments to pass to the Aztec binary
|
|
102
|
+
* @param logger - The logger to use
|
|
103
|
+
* @param env - Optional environment variables to set for the process
|
|
104
|
+
* @returns The exit code of the Aztec binary
|
|
105
|
+
*/ export function runAztecBin(args, logger, env) {
|
|
106
|
+
return runScript('node', [
|
|
107
|
+
getAztecBin(),
|
|
108
|
+
...args
|
|
109
|
+
], logger, env);
|
|
110
|
+
}
|
|
111
|
+
export function runProjectScript(script, args, logger, env) {
|
|
112
|
+
const scriptPath = script.startsWith('/') ? script : path.join(getGitProjectRoot(), script);
|
|
113
|
+
return runScript(scriptPath, args, logger, env);
|
|
114
|
+
}
|
|
68
115
|
export async function startPortForward({ resource, namespace, containerPort, hostPort }) {
|
|
69
116
|
const hostPortAsString = hostPort ? hostPort.toString() : '';
|
|
70
117
|
logger.info(`kubectl port-forward -n ${namespace} ${resource} ${hostPortAsString}:${containerPort}`);
|
|
71
|
-
const
|
|
118
|
+
const process1 = spawn('kubectl', [
|
|
72
119
|
'port-forward',
|
|
73
120
|
'-n',
|
|
74
121
|
namespace,
|
|
@@ -85,7 +132,7 @@ export async function startPortForward({ resource, namespace, containerPort, hos
|
|
|
85
132
|
});
|
|
86
133
|
let isResolved = false;
|
|
87
134
|
const connected = new Promise((resolve)=>{
|
|
88
|
-
|
|
135
|
+
process1.stdout?.on('data', (data)=>{
|
|
89
136
|
const str = data.toString();
|
|
90
137
|
if (!isResolved && str.includes('Forwarding from')) {
|
|
91
138
|
isResolved = true;
|
|
@@ -96,13 +143,12 @@ export async function startPortForward({ resource, namespace, containerPort, hos
|
|
|
96
143
|
}
|
|
97
144
|
const portNumber = parseInt(str.slice(port + 1));
|
|
98
145
|
logger.info(`Port forward connected: ${portNumber}`);
|
|
99
|
-
logger.info(`Port forward connected: ${portNumber}`);
|
|
100
146
|
resolve(portNumber);
|
|
101
147
|
} else {
|
|
102
148
|
logger.silent(str);
|
|
103
149
|
}
|
|
104
150
|
});
|
|
105
|
-
|
|
151
|
+
process1.stderr?.on('data', (data)=>{
|
|
106
152
|
logger.info(data.toString());
|
|
107
153
|
// It's a strange thing:
|
|
108
154
|
// If we don't pipe stderr, then the port forwarding does not work.
|
|
@@ -110,25 +156,25 @@ export async function startPortForward({ resource, namespace, containerPort, hos
|
|
|
110
156
|
// just extremely verbose debug logs.
|
|
111
157
|
logger.silent(data.toString());
|
|
112
158
|
});
|
|
113
|
-
|
|
159
|
+
process1.on('close', ()=>{
|
|
114
160
|
if (!isResolved) {
|
|
115
161
|
isResolved = true;
|
|
116
162
|
logger.warn('Port forward closed before connection established');
|
|
117
163
|
resolve(0);
|
|
118
164
|
}
|
|
119
165
|
});
|
|
120
|
-
|
|
166
|
+
process1.on('error', (error)=>{
|
|
121
167
|
logger.error(`Port forward error: ${error}`);
|
|
122
168
|
resolve(0);
|
|
123
169
|
});
|
|
124
|
-
|
|
170
|
+
process1.on('exit', (code)=>{
|
|
125
171
|
logger.info(`Port forward exited with code ${code}`);
|
|
126
172
|
resolve(0);
|
|
127
173
|
});
|
|
128
174
|
});
|
|
129
175
|
const port = await connected;
|
|
130
176
|
return {
|
|
131
|
-
process,
|
|
177
|
+
process: process1,
|
|
132
178
|
port
|
|
133
179
|
};
|
|
134
180
|
}
|
|
@@ -325,7 +371,7 @@ export async function enableValidatorDynamicBootNode(instanceName, namespace, sp
|
|
|
325
371
|
}
|
|
326
372
|
export async function runAlertCheck(config, alerts, logger) {
|
|
327
373
|
if (isK8sConfig(config)) {
|
|
328
|
-
const { process, port } = await startPortForward({
|
|
374
|
+
const { process: process1, port } = await startPortForward({
|
|
329
375
|
resource: `svc/metrics-grafana`,
|
|
330
376
|
namespace: 'metrics',
|
|
331
377
|
containerPort: config.CONTAINER_METRICS_PORT
|
|
@@ -335,7 +381,7 @@ export async function runAlertCheck(config, alerts, logger) {
|
|
|
335
381
|
grafanaCredentials: `admin:${config.GRAFANA_PASSWORD}`
|
|
336
382
|
});
|
|
337
383
|
await alertChecker.runAlertCheck(alerts);
|
|
338
|
-
|
|
384
|
+
process1.kill();
|
|
339
385
|
} else {
|
|
340
386
|
logger.info('Not running alert check in non-k8s environment');
|
|
341
387
|
}
|
|
@@ -353,14 +399,14 @@ export async function updateK8sSequencersConfig(args) {
|
|
|
353
399
|
const { containerPort, namespace, config } = args;
|
|
354
400
|
const sequencers = await getSequencers(namespace);
|
|
355
401
|
for (const sequencer of sequencers){
|
|
356
|
-
const { process, port } = await startPortForward({
|
|
402
|
+
const { process: process1, port } = await startPortForward({
|
|
357
403
|
resource: `pod/${sequencer}`,
|
|
358
404
|
namespace,
|
|
359
405
|
containerPort
|
|
360
406
|
});
|
|
361
407
|
const url = `http://localhost:${port}`;
|
|
362
408
|
await updateSequencerConfig(url, config);
|
|
363
|
-
|
|
409
|
+
process1.kill();
|
|
364
410
|
}
|
|
365
411
|
}
|
|
366
412
|
export async function updateSequencersConfig(env, config) {
|
|
@@ -443,3 +489,20 @@ export async function updateSequencersConfig(env, config) {
|
|
|
443
489
|
label: 'app=pxe'
|
|
444
490
|
});
|
|
445
491
|
}
|
|
492
|
+
/**
|
|
493
|
+
* Returns the absolute path to the git repository root
|
|
494
|
+
*/ export function getGitProjectRoot() {
|
|
495
|
+
try {
|
|
496
|
+
const rootDir = execSync('git rev-parse --show-toplevel', {
|
|
497
|
+
encoding: 'utf-8',
|
|
498
|
+
stdio: [
|
|
499
|
+
'ignore',
|
|
500
|
+
'pipe',
|
|
501
|
+
'ignore'
|
|
502
|
+
]
|
|
503
|
+
}).trim();
|
|
504
|
+
return rootDir;
|
|
505
|
+
} catch (error) {
|
|
506
|
+
throw new Error(`Failed to determine git project root: ${error}`);
|
|
507
|
+
}
|
|
508
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.80.0",
|
|
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.
|
|
30
|
-
"@aztec/archiver": "0.
|
|
31
|
-
"@aztec/aztec": "0.
|
|
32
|
-
"@aztec/aztec-node": "0.
|
|
33
|
-
"@aztec/aztec.js": "0.
|
|
34
|
-
"@aztec/bb-prover": "0.
|
|
35
|
-
"@aztec/blob-lib": "0.
|
|
36
|
-
"@aztec/blob-sink": "0.
|
|
37
|
-
"@aztec/bot": "0.
|
|
38
|
-
"@aztec/constants": "0.
|
|
39
|
-
"@aztec/entrypoints": "0.
|
|
40
|
-
"@aztec/epoch-cache": "0.
|
|
41
|
-
"@aztec/ethereum": "0.
|
|
42
|
-
"@aztec/foundation": "0.
|
|
43
|
-
"@aztec/kv-store": "0.
|
|
44
|
-
"@aztec/l1-artifacts": "0.
|
|
45
|
-
"@aztec/merkle-tree": "0.
|
|
46
|
-
"@aztec/noir-contracts.js": "0.
|
|
47
|
-
"@aztec/noir-protocol-circuits-types": "0.
|
|
48
|
-
"@aztec/p2p": "0.
|
|
49
|
-
"@aztec/protocol-contracts": "0.
|
|
50
|
-
"@aztec/prover-client": "0.
|
|
51
|
-
"@aztec/prover-node": "0.
|
|
52
|
-
"@aztec/pxe": "0.
|
|
53
|
-
"@aztec/sequencer-client": "0.
|
|
54
|
-
"@aztec/simulator": "0.
|
|
55
|
-
"@aztec/stdlib": "0.
|
|
56
|
-
"@aztec/telemetry-client": "0.
|
|
57
|
-
"@aztec/validator-client": "0.
|
|
58
|
-
"@aztec/world-state": "0.
|
|
29
|
+
"@aztec/accounts": "0.80.0",
|
|
30
|
+
"@aztec/archiver": "0.80.0",
|
|
31
|
+
"@aztec/aztec": "0.80.0",
|
|
32
|
+
"@aztec/aztec-node": "0.80.0",
|
|
33
|
+
"@aztec/aztec.js": "0.80.0",
|
|
34
|
+
"@aztec/bb-prover": "0.80.0",
|
|
35
|
+
"@aztec/blob-lib": "0.80.0",
|
|
36
|
+
"@aztec/blob-sink": "0.80.0",
|
|
37
|
+
"@aztec/bot": "0.80.0",
|
|
38
|
+
"@aztec/constants": "0.80.0",
|
|
39
|
+
"@aztec/entrypoints": "0.80.0",
|
|
40
|
+
"@aztec/epoch-cache": "0.80.0",
|
|
41
|
+
"@aztec/ethereum": "0.80.0",
|
|
42
|
+
"@aztec/foundation": "0.80.0",
|
|
43
|
+
"@aztec/kv-store": "0.80.0",
|
|
44
|
+
"@aztec/l1-artifacts": "0.80.0",
|
|
45
|
+
"@aztec/merkle-tree": "0.80.0",
|
|
46
|
+
"@aztec/noir-contracts.js": "0.80.0",
|
|
47
|
+
"@aztec/noir-protocol-circuits-types": "0.80.0",
|
|
48
|
+
"@aztec/p2p": "0.80.0",
|
|
49
|
+
"@aztec/protocol-contracts": "0.80.0",
|
|
50
|
+
"@aztec/prover-client": "0.80.0",
|
|
51
|
+
"@aztec/prover-node": "0.80.0",
|
|
52
|
+
"@aztec/pxe": "0.80.0",
|
|
53
|
+
"@aztec/sequencer-client": "0.80.0",
|
|
54
|
+
"@aztec/simulator": "0.80.0",
|
|
55
|
+
"@aztec/stdlib": "0.80.0",
|
|
56
|
+
"@aztec/telemetry-client": "0.80.0",
|
|
57
|
+
"@aztec/validator-client": "0.80.0",
|
|
58
|
+
"@aztec/world-state": "0.80.0",
|
|
59
59
|
"@iarna/toml": "^2.2.5",
|
|
60
60
|
"@jest/globals": "^29.5.0",
|
|
61
61
|
"@noble/curves": "^1.0.0",
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { getInitialTestAccountsWallets } from '@aztec/accounts/testing';
|
|
3
3
|
import { Contract, createPXEClient, loadContractArtifact, waitForPXE } from '@aztec/aztec.js';
|
|
4
4
|
// docs:end:deploy-imports
|
|
5
|
+
// docs:start:import_artifact
|
|
5
6
|
import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
|
|
7
|
+
// docs:end:import_artifact
|
|
6
8
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
7
9
|
|
|
8
10
|
import { writeFileSync } from 'fs';
|
package/src/spartan/utils.ts
CHANGED
|
@@ -86,6 +86,49 @@ export function setupEnvironment(env: unknown): EnvConfig {
|
|
|
86
86
|
return config;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* @param path - The path to the script, relative to the project root
|
|
91
|
+
* @param args - The arguments to pass to the script
|
|
92
|
+
* @param logger - The logger to use
|
|
93
|
+
* @returns The exit code of the script
|
|
94
|
+
*/
|
|
95
|
+
function runScript(path: string, args: string[], logger: Logger, env?: Record<string, string>) {
|
|
96
|
+
const childProcess = spawn(path, args, {
|
|
97
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
98
|
+
env: env ? { ...process.env, ...env } : process.env,
|
|
99
|
+
});
|
|
100
|
+
return new Promise<number>((resolve, reject) => {
|
|
101
|
+
childProcess.on('close', (code: number | null) => resolve(code ?? 0));
|
|
102
|
+
childProcess.on('error', reject);
|
|
103
|
+
childProcess.stdout?.on('data', (data: Buffer) => {
|
|
104
|
+
logger.info(data.toString());
|
|
105
|
+
});
|
|
106
|
+
childProcess.stderr?.on('data', (data: Buffer) => {
|
|
107
|
+
logger.error(data.toString());
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function getAztecBin() {
|
|
113
|
+
return path.join(getGitProjectRoot(), 'yarn-project/aztec/dest/bin/index.js');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Runs the Aztec binary
|
|
118
|
+
* @param args - The arguments to pass to the Aztec binary
|
|
119
|
+
* @param logger - The logger to use
|
|
120
|
+
* @param env - Optional environment variables to set for the process
|
|
121
|
+
* @returns The exit code of the Aztec binary
|
|
122
|
+
*/
|
|
123
|
+
export function runAztecBin(args: string[], logger: Logger, env?: Record<string, string>) {
|
|
124
|
+
return runScript('node', [getAztecBin(), ...args], logger, env);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function runProjectScript(script: string, args: string[], logger: Logger, env?: Record<string, string>) {
|
|
128
|
+
const scriptPath = script.startsWith('/') ? script : path.join(getGitProjectRoot(), script);
|
|
129
|
+
return runScript(scriptPath, args, logger, env);
|
|
130
|
+
}
|
|
131
|
+
|
|
89
132
|
export async function startPortForward({
|
|
90
133
|
resource,
|
|
91
134
|
namespace,
|
|
@@ -128,7 +171,6 @@ export async function startPortForward({
|
|
|
128
171
|
}
|
|
129
172
|
const portNumber = parseInt(str.slice(port + 1));
|
|
130
173
|
logger.info(`Port forward connected: ${portNumber}`);
|
|
131
|
-
logger.info(`Port forward connected: ${portNumber}`);
|
|
132
174
|
resolve(portNumber);
|
|
133
175
|
} else {
|
|
134
176
|
logger.silent(str);
|
|
@@ -580,3 +622,19 @@ export async function rollAztecPods(namespace: string) {
|
|
|
580
622
|
await waitForResourceByLabel({ resource: 'pods', namespace: namespace, label: 'app=validator' });
|
|
581
623
|
await waitForResourceByLabel({ resource: 'pods', namespace: namespace, label: 'app=pxe' });
|
|
582
624
|
}
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Returns the absolute path to the git repository root
|
|
628
|
+
*/
|
|
629
|
+
export function getGitProjectRoot(): string {
|
|
630
|
+
try {
|
|
631
|
+
const rootDir = execSync('git rev-parse --show-toplevel', {
|
|
632
|
+
encoding: 'utf-8',
|
|
633
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
634
|
+
}).trim();
|
|
635
|
+
|
|
636
|
+
return rootDir;
|
|
637
|
+
} catch (error) {
|
|
638
|
+
throw new Error(`Failed to determine git project root: ${error}`);
|
|
639
|
+
}
|
|
640
|
+
}
|