@aztec/aztec 0.0.1-commit.0dc957cde → 0.0.1-commit.0ec55a70b
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/cli/aztec_start_action.js +1 -1
- package/dest/cli/aztec_start_options.d.ts +1 -1
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +0 -6
- package/dest/cli/cmds/profile.d.ts +1 -1
- package/dest/cli/cmds/profile.d.ts.map +1 -1
- package/dest/cli/cmds/profile.js +1 -1
- package/dest/cli/cmds/profile_gates.d.ts +2 -2
- package/dest/cli/cmds/profile_gates.d.ts.map +1 -1
- package/dest/cli/cmds/profile_gates.js +21 -3
- package/dest/cli/cmds/start_prover_agent.js +2 -2
- package/dest/cli/cmds/start_prover_broker.js +2 -2
- package/dest/cli/cmds/start_txe.d.ts +2 -2
- package/dest/cli/cmds/start_txe.d.ts.map +1 -1
- package/dest/cli/cmds/start_txe.js +4 -3
- package/package.json +33 -33
- package/scripts/add_crate.sh +8 -58
- package/scripts/init.sh +5 -5
- package/scripts/new.sh +2 -2
- package/scripts/setup_workspace.sh +3 -2
- package/scripts/templates/blank/contract/Nargo.toml +6 -0
- package/scripts/templates/blank/contract/src/main.nr +10 -0
- package/scripts/templates/blank/test/Nargo.toml +7 -0
- package/scripts/templates/blank/test/src/lib.nr +11 -0
- package/scripts/templates/counter/contract/Nargo.toml +7 -0
- package/scripts/templates/counter/contract/src/main.nr +48 -0
- package/scripts/templates/counter/test/Nargo.toml +7 -0
- package/scripts/templates/counter/test/src/lib.nr +32 -0
- package/src/cli/aztec_start_action.ts +1 -1
- package/src/cli/aztec_start_options.ts +1 -9
- package/src/cli/cmds/profile.ts +2 -1
- package/src/cli/cmds/profile_gates.ts +20 -4
- package/src/cli/cmds/start_prover_agent.ts +2 -2
- package/src/cli/cmds/start_prover_broker.ts +2 -2
- package/src/cli/cmds/start_txe.ts +5 -3
|
@@ -77,7 +77,7 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
77
77
|
await startProverBroker(options, signalHandlers, services, userLog);
|
|
78
78
|
} else if (options.txe) {
|
|
79
79
|
const { startTXE } = await import('./cmds/start_txe.js');
|
|
80
|
-
await startTXE(options, debugLogger);
|
|
80
|
+
await startTXE(options, signalHandlers, debugLogger);
|
|
81
81
|
} else if (options.sequencer) {
|
|
82
82
|
userLog(`Cannot run a standalone sequencer without a node`);
|
|
83
83
|
process.exit(1);
|
|
@@ -14,4 +14,4 @@ export declare const NETWORK_FLAG = "network";
|
|
|
14
14
|
export declare const aztecStartOptions: {
|
|
15
15
|
[key: string]: AztecStartOption[];
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXp0ZWNfc3RhcnRfb3B0aW9ucy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS9henRlY19zdGFydF9vcHRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9BLE9BQU8sRUFDTCxLQUFLLGFBQWEsRUFDbEIsS0FBSyxNQUFNLEVBSVosTUFBTSwwQkFBMEIsQ0FBQztBQWVsQyxNQUFNLFdBQVcsZ0JBQWdCO0lBQy9CLElBQUksRUFBRSxNQUFNLENBQUM7SUFDYixXQUFXLEVBQUUsTUFBTSxDQUFDO0lBQ3BCLFlBQVksRUFBRSxHQUFHLENBQUM7SUFDbEIsWUFBWSxDQUFDLEVBQUUsQ0FBQyxHQUFHLEVBQUUsR0FBRyxLQUFLLE1BQU0sQ0FBQztJQUNwQyxHQUFHLEVBQUUsTUFBTSxHQUFHLFNBQVMsQ0FBQztJQUN4QixRQUFRLENBQUMsRUFBRSxNQUFNLEVBQUUsQ0FBQztJQUNwQixRQUFRLENBQUMsRUFBRSxDQUFDLEdBQUcsRUFBRSxNQUFNLEtBQUssR0FBRyxDQUFDO0NBQ2pDO0FBRUQsZUFBTyxNQUFNLFVBQVUsbUdBb0J0QixDQUFDO0FBMkJGLGVBQU8sTUFBTSxnQkFBZ0IsVUFZNUIsQ0FBQztBQUVGLGVBQU8sTUFBTSxZQUFZLFlBQVksQ0FBQztBQUd0QyxlQUFPLE1BQU0saUJBQWlCLEVBQUU7SUFBRSxDQUFDLEdBQUcsRUFBRSxNQUFNLEdBQUcsZ0JBQWdCLEVBQUUsQ0FBQTtDQTJPbEUsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aztec_start_options.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_options.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,MAAM,EAIZ,MAAM,0BAA0B,CAAC;AAelC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,GAAG,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IACpC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;CACjC;AAED,eAAO,MAAM,UAAU,mGAoBtB,CAAC;AA2BF,eAAO,MAAM,gBAAgB,UAY5B,CAAC;AAEF,eAAO,MAAM,YAAY,YAAY,CAAC;AAGtC,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"aztec_start_options.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_options.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,MAAM,EAIZ,MAAM,0BAA0B,CAAC;AAelC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,GAAG,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IACpC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;CACjC;AAED,eAAO,MAAM,UAAU,mGAoBtB,CAAC;AA2BF,eAAO,MAAM,gBAAgB,UAY5B,CAAC;AAEF,eAAO,MAAM,YAAY,YAAY,CAAC;AAGtC,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;CA2OlE,CAAC"}
|
|
@@ -279,12 +279,6 @@ export const aztecStartOptions = {
|
|
|
279
279
|
...getOptions('bot', botConfigMappings)
|
|
280
280
|
],
|
|
281
281
|
PXE: [
|
|
282
|
-
{
|
|
283
|
-
flag: '--pxe',
|
|
284
|
-
description: 'Starts Aztec PXE with options',
|
|
285
|
-
defaultValue: undefined,
|
|
286
|
-
env: undefined
|
|
287
|
-
},
|
|
288
282
|
...getOptions('pxe', allPxeConfigMappings)
|
|
289
283
|
],
|
|
290
284
|
TXE: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
import type { Command } from 'commander';
|
|
3
3
|
export declare function injectProfileCommand(program: Command, log: LogFn): Command;
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3Byb2ZpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFbkQsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBS3pDLHdCQUFnQixvQkFBb0IsQ0FBQyxPQUFPLEVBQUUsT0FBTyxFQUFFLEdBQUcsRUFBRSxLQUFLLEdBQUcsT0FBTyxDQWtCMUUifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAkB1E"}
|
package/dest/cli/cmds/profile.js
CHANGED
|
@@ -2,7 +2,7 @@ import { profileFlamegraph } from './profile_flamegraph.js';
|
|
|
2
2
|
import { profileGates } from './profile_gates.js';
|
|
3
3
|
export function injectProfileCommand(program, log) {
|
|
4
4
|
const profile = program.command('profile').description('Profile compiled Aztec artifacts.');
|
|
5
|
-
profile.command('gates').argument('[target-dir]', 'Path to the compiled artifacts directory', './target').description('Display gate counts for all compiled Aztec artifacts in a target directory.').action((targetDir)=>profileGates(targetDir, log));
|
|
5
|
+
profile.command('gates').argument('[target-dir]', 'Path to the compiled artifacts directory', './target').option('--json', 'Output gate counts as JSON instead of a table', false).description('Display gate counts for all compiled Aztec artifacts in a target directory.').action((targetDir, options)=>profileGates(targetDir, options.json, log));
|
|
6
6
|
profile.command('flamegraph').argument('<contract-artifact>', 'Path to the compiled contract artifact JSON').argument('<function>', 'Name of the contract function to profile').description('Generate a gate count flamegraph SVG for a contract function.').action((artifactPath, functionName)=>profileFlamegraph(artifactPath, functionName, log));
|
|
7
7
|
return program;
|
|
8
8
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
/** Profiles all compiled artifacts in a target directory and prints gate counts. */
|
|
3
|
-
export declare function profileGates(targetDir: string, log: LogFn): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
3
|
+
export declare function profileGates(targetDir: string, json: boolean, log: LogFn): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZV9nYXRlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3Byb2ZpbGVfZ2F0ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFnQ25ELG9GQUFvRjtBQUNwRix3QkFBc0IsWUFBWSxDQUFDLFNBQVMsRUFBRSxNQUFNLEVBQUUsSUFBSSxFQUFFLE9BQU8sRUFBRSxHQUFHLEVBQUUsS0FBSyxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FnRDlGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile_gates.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile_gates.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"profile_gates.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile_gates.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAgCnD,oFAAoF;AACpF,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAgD9F"}
|
|
@@ -23,21 +23,39 @@ const execFile = promisify(execFileCb);
|
|
|
23
23
|
]);
|
|
24
24
|
return parseGateCount(stdout);
|
|
25
25
|
}
|
|
26
|
-
/** Profiles all compiled artifacts in a target directory and prints gate counts. */ export async function profileGates(targetDir, log) {
|
|
26
|
+
/** Profiles all compiled artifacts in a target directory and prints gate counts. */ export async function profileGates(targetDir, json, log) {
|
|
27
27
|
const bb = process.env.BB ?? findBbBinary() ?? 'bb';
|
|
28
28
|
const { artifacts, tmpDir } = await discoverArtifacts(targetDir);
|
|
29
29
|
if (artifacts.length === 0) {
|
|
30
|
-
|
|
30
|
+
if (json) {
|
|
31
|
+
log('[]');
|
|
32
|
+
} else {
|
|
33
|
+
log('No artifacts found in target directory.');
|
|
34
|
+
}
|
|
31
35
|
return;
|
|
32
36
|
}
|
|
33
37
|
try {
|
|
34
38
|
const results = await asyncPool(MAX_CONCURRENT, artifacts, async (artifact)=>({
|
|
35
39
|
name: artifact.name,
|
|
40
|
+
type: artifact.type,
|
|
36
41
|
gateCount: await getGateCount(bb, artifact.filePath)
|
|
37
42
|
}));
|
|
38
43
|
results.sort((a, b)=>a.name.localeCompare(b.name));
|
|
39
44
|
if (results.length === 0) {
|
|
40
|
-
|
|
45
|
+
if (json) {
|
|
46
|
+
log('[]');
|
|
47
|
+
} else {
|
|
48
|
+
log('No constrained circuits found.');
|
|
49
|
+
}
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (json) {
|
|
53
|
+
const entries = results.map((r)=>({
|
|
54
|
+
name: r.name,
|
|
55
|
+
type: r.type,
|
|
56
|
+
gates: r.gateCount
|
|
57
|
+
}));
|
|
58
|
+
log(JSON.stringify(entries, null, 2));
|
|
41
59
|
return;
|
|
42
60
|
}
|
|
43
61
|
const maxNameLen = Math.max(...results.map((r)=>r.name.length));
|
|
@@ -8,8 +8,8 @@ import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } f
|
|
|
8
8
|
import { extractRelevantOptions, preloadCrsDataForServerSideProving } from '../util.js';
|
|
9
9
|
import { getVersions } from '../versioning.js';
|
|
10
10
|
export async function startProverAgent(options, signalHandlers, services, userLog) {
|
|
11
|
-
if (options.node || options.sequencer || options.
|
|
12
|
-
userLog(`Starting a prover agent with --node, --sequencer, --
|
|
11
|
+
if (options.node || options.sequencer || options.p2pBootstrap || options.txe) {
|
|
12
|
+
userLog(`Starting a prover agent with --node, --sequencer, --p2p-bootstrap, or --txe is not supported.`);
|
|
13
13
|
process.exit(1);
|
|
14
14
|
}
|
|
15
15
|
const config = {
|
|
@@ -8,8 +8,8 @@ import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } fro
|
|
|
8
8
|
import { extractRelevantOptions } from '../util.js';
|
|
9
9
|
import { computeExpectedGenesisRoot, waitForCompatibleRollup } from './standby.js';
|
|
10
10
|
export async function startProverBroker(options, signalHandlers, services, userLog) {
|
|
11
|
-
if (options.node || options.sequencer || options.
|
|
12
|
-
userLog(`Starting a prover broker with --node, --sequencer, --
|
|
11
|
+
if (options.node || options.sequencer || options.p2pBootstrap || options.txe) {
|
|
12
|
+
userLog(`Starting a prover broker with --node, --sequencer, --p2p-bootstrap, or --txe is not supported.`);
|
|
13
13
|
process.exit(1);
|
|
14
14
|
}
|
|
15
15
|
const config = {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
-
export declare function startTXE(options: any, debugLogger: Logger): Promise<void>;
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
2
|
+
export declare function startTXE(options: any, signalHandlers: Array<() => Promise<void>>, debugLogger: Logger): Promise<void>;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfdHhlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2NtZHMvc3RhcnRfdHhlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBR3BELHdCQUFzQixRQUFRLENBQUMsT0FBTyxFQUFFLEdBQUcsRUFBRSxjQUFjLEVBQUUsS0FBSyxDQUFDLE1BQU0sT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLEVBQUUsV0FBVyxFQUFFLE1BQU0saUJBWTNHIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_txe.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_txe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,wBAAsB,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"start_txe.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_txe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,wBAAsB,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,iBAY3G"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
2
2
|
import { createTXERpcServer } from '@aztec/txe';
|
|
3
|
-
export async function startTXE(options, debugLogger) {
|
|
3
|
+
export async function startTXE(options, signalHandlers, debugLogger) {
|
|
4
4
|
debugLogger.info(`Setting up TXE...`);
|
|
5
5
|
const txeServer = createTXERpcServer(debugLogger);
|
|
6
|
-
const
|
|
6
|
+
const httpServer = await startHttpRpcServer(txeServer, {
|
|
7
7
|
port: options.port,
|
|
8
8
|
timeoutMs: 1e3 * 60 * 5
|
|
9
9
|
});
|
|
10
|
-
|
|
10
|
+
signalHandlers.push(()=>new Promise((resolve)=>httpServer.close(()=>resolve())));
|
|
11
|
+
debugLogger.info(`TXE listening on port ${httpServer.port}`);
|
|
11
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.0ec55a70b",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -28,38 +28,38 @@
|
|
|
28
28
|
"../package.common.json"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
32
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
33
|
-
"@aztec/aztec-node": "0.0.1-commit.
|
|
34
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
35
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
36
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
37
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
38
|
-
"@aztec/bot": "0.0.1-commit.
|
|
39
|
-
"@aztec/builder": "0.0.1-commit.
|
|
40
|
-
"@aztec/cli": "0.0.1-commit.
|
|
41
|
-
"@aztec/constants": "0.0.1-commit.
|
|
42
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
43
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
44
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
45
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
46
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
47
|
-
"@aztec/node-lib": "0.0.1-commit.
|
|
48
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
49
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
50
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
51
|
-
"@aztec/p2p-bootstrap": "0.0.1-commit.
|
|
52
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
53
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
54
|
-
"@aztec/prover-node": "0.0.1-commit.
|
|
55
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
56
|
-
"@aztec/sequencer-client": "0.0.1-commit.
|
|
57
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
58
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
59
|
-
"@aztec/txe": "0.0.1-commit.
|
|
60
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
61
|
-
"@aztec/wallets": "0.0.1-commit.
|
|
62
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
31
|
+
"@aztec/accounts": "0.0.1-commit.0ec55a70b",
|
|
32
|
+
"@aztec/archiver": "0.0.1-commit.0ec55a70b",
|
|
33
|
+
"@aztec/aztec-node": "0.0.1-commit.0ec55a70b",
|
|
34
|
+
"@aztec/aztec.js": "0.0.1-commit.0ec55a70b",
|
|
35
|
+
"@aztec/bb-prover": "0.0.1-commit.0ec55a70b",
|
|
36
|
+
"@aztec/bb.js": "0.0.1-commit.0ec55a70b",
|
|
37
|
+
"@aztec/blob-client": "0.0.1-commit.0ec55a70b",
|
|
38
|
+
"@aztec/bot": "0.0.1-commit.0ec55a70b",
|
|
39
|
+
"@aztec/builder": "0.0.1-commit.0ec55a70b",
|
|
40
|
+
"@aztec/cli": "0.0.1-commit.0ec55a70b",
|
|
41
|
+
"@aztec/constants": "0.0.1-commit.0ec55a70b",
|
|
42
|
+
"@aztec/entrypoints": "0.0.1-commit.0ec55a70b",
|
|
43
|
+
"@aztec/ethereum": "0.0.1-commit.0ec55a70b",
|
|
44
|
+
"@aztec/foundation": "0.0.1-commit.0ec55a70b",
|
|
45
|
+
"@aztec/kv-store": "0.0.1-commit.0ec55a70b",
|
|
46
|
+
"@aztec/l1-artifacts": "0.0.1-commit.0ec55a70b",
|
|
47
|
+
"@aztec/node-lib": "0.0.1-commit.0ec55a70b",
|
|
48
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.0ec55a70b",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.0ec55a70b",
|
|
50
|
+
"@aztec/p2p": "0.0.1-commit.0ec55a70b",
|
|
51
|
+
"@aztec/p2p-bootstrap": "0.0.1-commit.0ec55a70b",
|
|
52
|
+
"@aztec/protocol-contracts": "0.0.1-commit.0ec55a70b",
|
|
53
|
+
"@aztec/prover-client": "0.0.1-commit.0ec55a70b",
|
|
54
|
+
"@aztec/prover-node": "0.0.1-commit.0ec55a70b",
|
|
55
|
+
"@aztec/pxe": "0.0.1-commit.0ec55a70b",
|
|
56
|
+
"@aztec/sequencer-client": "0.0.1-commit.0ec55a70b",
|
|
57
|
+
"@aztec/stdlib": "0.0.1-commit.0ec55a70b",
|
|
58
|
+
"@aztec/telemetry-client": "0.0.1-commit.0ec55a70b",
|
|
59
|
+
"@aztec/txe": "0.0.1-commit.0ec55a70b",
|
|
60
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.0ec55a70b",
|
|
61
|
+
"@aztec/wallets": "0.0.1-commit.0ec55a70b",
|
|
62
|
+
"@aztec/world-state": "0.0.1-commit.0ec55a70b",
|
|
63
63
|
"@iarna/toml": "^2.2.5",
|
|
64
64
|
"@types/chalk": "^2.2.0",
|
|
65
65
|
"abitype": "^0.8.11",
|
package/scripts/add_crate.sh
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
# Creates a contract+test crate pair and adds them to an existing workspace.
|
|
5
|
-
# Usage: add_crate.sh <crate_name>
|
|
5
|
+
# Usage: add_crate.sh <crate_name> <template>
|
|
6
6
|
# Must be called from a workspace root that already has Nargo.toml with [workspace].
|
|
7
7
|
|
|
8
8
|
crate_name=$1
|
|
9
|
+
template=$2
|
|
9
10
|
|
|
10
11
|
if [ -z "$crate_name" ]; then
|
|
11
12
|
echo "Error: crate name is required"
|
|
@@ -31,64 +32,13 @@ fi
|
|
|
31
32
|
|
|
32
33
|
# Get the actual aztec version for the git tag.
|
|
33
34
|
AZTEC_VERSION=$(jq -r '.version' $(dirname $0)/../package.json)
|
|
35
|
+
TEMPLATE_DIR="$(dirname $0)/templates/$template"
|
|
34
36
|
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
type = "contract"
|
|
41
|
-
|
|
42
|
-
[dependencies]
|
|
43
|
-
aztec = { git="https://github.com/AztecProtocol/aztec-nr", tag="v${AZTEC_VERSION}", directory="aztec" }
|
|
44
|
-
CEOF
|
|
45
|
-
|
|
46
|
-
cat > "$contract_dir/src/main.nr" << 'EOF'
|
|
47
|
-
use aztec::macros::aztec;
|
|
48
|
-
|
|
49
|
-
#[aztec]
|
|
50
|
-
pub contract Main {
|
|
51
|
-
use aztec::macros::functions::{external, initializer};
|
|
52
|
-
|
|
53
|
-
#[initializer]
|
|
54
|
-
#[external("private")]
|
|
55
|
-
fn constructor() {}
|
|
56
|
-
}
|
|
57
|
-
EOF
|
|
58
|
-
|
|
59
|
-
# Create test crate
|
|
60
|
-
mkdir -p "$test_dir/src"
|
|
61
|
-
cat > "$test_dir/Nargo.toml" << TEOF
|
|
62
|
-
[package]
|
|
63
|
-
name = "${crate_name}_test"
|
|
64
|
-
type = "lib"
|
|
65
|
-
|
|
66
|
-
[dependencies]
|
|
67
|
-
aztec = { git="https://github.com/AztecProtocol/aztec-nr", tag="v${AZTEC_VERSION}", directory="aztec" }
|
|
68
|
-
${crate_name}_contract = { path = "../${contract_dir}" }
|
|
69
|
-
TEOF
|
|
70
|
-
|
|
71
|
-
cat > "$test_dir/src/lib.nr" << 'NOIR'
|
|
72
|
-
use aztec::test::helpers::test_environment::TestEnvironment;
|
|
73
|
-
use __CRATE_NAME___contract::Main;
|
|
74
|
-
|
|
75
|
-
#[test]
|
|
76
|
-
unconstrained fn test_constructor() {
|
|
77
|
-
let mut env = TestEnvironment::new();
|
|
78
|
-
let deployer = env.create_light_account();
|
|
79
|
-
|
|
80
|
-
// Deploy the contract with the default constructor:
|
|
81
|
-
let contract_address = env.deploy("@__CRATE_NAME___contract/Main").with_private_initializer(
|
|
82
|
-
deployer,
|
|
83
|
-
Main::interface().constructor(),
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
// Deploy without an initializer:
|
|
87
|
-
let contract_address = env.deploy("@__CRATE_NAME___contract/Main").without_initializer();
|
|
88
|
-
}
|
|
89
|
-
NOIR
|
|
90
|
-
|
|
91
|
-
sed -i "s/__CRATE_NAME__/${crate_name}/g" "$test_dir/src/lib.nr"
|
|
37
|
+
# Copy template crates and substitute placeholders
|
|
38
|
+
cp -r "$TEMPLATE_DIR/contract" "$contract_dir"
|
|
39
|
+
cp -r "$TEMPLATE_DIR/test" "$test_dir"
|
|
40
|
+
find "$contract_dir" "$test_dir" -type f -exec \
|
|
41
|
+
sed -i -e "s/__CRATE_NAME__/${crate_name}/g" -e "s/__AZTEC_VERSION__/${AZTEC_VERSION}/g" {} +
|
|
92
42
|
|
|
93
43
|
# Add members to workspace Nargo.toml
|
|
94
44
|
if grep -q 'members\s*=\s*\[\s*\]' Nargo.toml; then
|
package/scripts/init.sh
CHANGED
|
@@ -16,11 +16,11 @@ Options:
|
|
|
16
16
|
-h, --help Print help
|
|
17
17
|
|
|
18
18
|
This command creates a new Aztec Noir project in the current directory with
|
|
19
|
-
a workspace containing a contract
|
|
20
|
-
|
|
19
|
+
a workspace containing a Counter contract example with tests. The Counter
|
|
20
|
+
demonstrates private state, private functions, and utility reads.
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
Use 'aztec new <name>' to create a blank contract project, or to add another
|
|
23
|
+
contract to an existing workspace.
|
|
24
24
|
EOF
|
|
25
25
|
exit 0
|
|
26
26
|
;;
|
|
@@ -36,4 +36,4 @@ done
|
|
|
36
36
|
package_name="$(basename $(pwd))"
|
|
37
37
|
|
|
38
38
|
echo "Initializing Aztec contract project..."
|
|
39
|
-
$script_path/setup_workspace.sh "$package_name"
|
|
39
|
+
$script_path/setup_workspace.sh "$package_name" counter
|
package/scripts/new.sh
CHANGED
|
@@ -68,7 +68,7 @@ fi
|
|
|
68
68
|
if [ -f "Nargo.toml" ] && grep -q '\[workspace\]' Nargo.toml; then
|
|
69
69
|
# Add crate pair to existing workspace
|
|
70
70
|
echo "Adding contract '$package_name' to existing workspace..."
|
|
71
|
-
$script_path/add_crate.sh "$package_name"
|
|
71
|
+
$script_path/add_crate.sh "$package_name" blank
|
|
72
72
|
else
|
|
73
73
|
# Create new workspace
|
|
74
74
|
if [ -d "$project_path" ] && [ "$(ls -A $project_path 2>/dev/null)" ]; then
|
|
@@ -79,5 +79,5 @@ else
|
|
|
79
79
|
echo "Creating new Aztec contract project at $project_path..."
|
|
80
80
|
mkdir -p "$project_path"
|
|
81
81
|
cd "$project_path"
|
|
82
|
-
$script_path/setup_workspace.sh "$package_name"
|
|
82
|
+
$script_path/setup_workspace.sh "$package_name" blank
|
|
83
83
|
fi
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
# Creates an Aztec contract workspace with a contract crate and a test crate.
|
|
5
|
-
# Usage: setup_workspace.sh <package_name>
|
|
5
|
+
# Usage: setup_workspace.sh <package_name> <template>
|
|
6
6
|
# Must be called from the workspace root directory.
|
|
7
7
|
|
|
8
8
|
package_name=$1
|
|
9
|
+
template=$2
|
|
9
10
|
script_path=$(realpath $(dirname "$0"))
|
|
10
11
|
|
|
11
12
|
if [ -z "$package_name" ]; then
|
|
@@ -26,7 +27,7 @@ members = []
|
|
|
26
27
|
EOF
|
|
27
28
|
|
|
28
29
|
# Create the first crate pair
|
|
29
|
-
$script_path/add_crate.sh "$package_name"
|
|
30
|
+
$script_path/add_crate.sh "$package_name" "$template"
|
|
30
31
|
|
|
31
32
|
# Create README
|
|
32
33
|
cat > README.md << REOF
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
use aztec::test::helpers::test_environment::TestEnvironment;
|
|
2
|
+
use __CRATE_NAME___contract::Main;
|
|
3
|
+
|
|
4
|
+
#[test]
|
|
5
|
+
unconstrained fn test_constructor() {
|
|
6
|
+
let mut env = TestEnvironment::new();
|
|
7
|
+
let deployer = env.create_light_account();
|
|
8
|
+
|
|
9
|
+
let _contract_address = env.deploy("@__CRATE_NAME___contract/Main")
|
|
10
|
+
.with_private_initializer(deployer, Main::interface().constructor());
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "__CRATE_NAME___contract"
|
|
3
|
+
type = "contract"
|
|
4
|
+
|
|
5
|
+
[dependencies]
|
|
6
|
+
aztec = { git="https://github.com/AztecProtocol/aztec-nr", tag="v__AZTEC_VERSION__", directory="aztec" }
|
|
7
|
+
balance_set = { git="https://github.com/AztecProtocol/aztec-nr", tag="v__AZTEC_VERSION__", directory="balance-set" }
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
use aztec::macros::aztec;
|
|
2
|
+
|
|
3
|
+
#[aztec]
|
|
4
|
+
pub contract Counter {
|
|
5
|
+
use aztec::{
|
|
6
|
+
macros::{functions::{external, initializer}, storage::storage},
|
|
7
|
+
messages::message_delivery::MessageDelivery,
|
|
8
|
+
protocol::address::AztecAddress,
|
|
9
|
+
state_vars::Owned,
|
|
10
|
+
};
|
|
11
|
+
use balance_set::BalanceSet;
|
|
12
|
+
|
|
13
|
+
#[storage]
|
|
14
|
+
struct Storage<Context> {
|
|
15
|
+
// Each owner has their own counter, stored as private encrypted notes.
|
|
16
|
+
// Owned: dictates who will receive the encrypted notes.
|
|
17
|
+
// BalanceSet: manages the underlying notes, providing add/sub/balance_of.
|
|
18
|
+
counters: Owned<BalanceSet<Context>, Context>,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Sets the owner's counter to an initial value.
|
|
22
|
+
//
|
|
23
|
+
// #[external("private")]: executes on the user's device, inputs are hidden from everyone.
|
|
24
|
+
#[initializer]
|
|
25
|
+
#[external("private")]
|
|
26
|
+
fn constructor(initial_value: u128, owner: AztecAddress) {
|
|
27
|
+
// Delivers the note to the recipient onchain with provable correctness.
|
|
28
|
+
// Without delivery, the recipient can't find or decrypt the note.
|
|
29
|
+
self.storage.counters.at(owner).add(initial_value).deliver(
|
|
30
|
+
MessageDelivery.ONCHAIN_CONSTRAINED,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Adds 1 to the owner's counter.
|
|
35
|
+
#[external("private")]
|
|
36
|
+
fn increment(owner: AztecAddress) {
|
|
37
|
+
self.storage.counters.at(owner).add(1).deliver(MessageDelivery.ONCHAIN_CONSTRAINED);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Returns the current value of the owner's counter.
|
|
41
|
+
//
|
|
42
|
+
// #[external("utility")]: runs off-chain, no transaction created, no cost.
|
|
43
|
+
// Only the owner can decrypt and read their own counter.
|
|
44
|
+
#[external("utility")]
|
|
45
|
+
unconstrained fn get_counter(owner: AztecAddress) -> u128 {
|
|
46
|
+
self.storage.counters.at(owner).balance_of()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
use aztec::{protocol::address::AztecAddress, test::helpers::test_environment::TestEnvironment};
|
|
2
|
+
use __CRATE_NAME___contract::Counter;
|
|
3
|
+
|
|
4
|
+
unconstrained fn setup(initial_value: u128) -> (TestEnvironment, AztecAddress, AztecAddress) {
|
|
5
|
+
let mut env = TestEnvironment::new();
|
|
6
|
+
let owner = env.create_light_account();
|
|
7
|
+
|
|
8
|
+
let contract_address = env.deploy("@__CRATE_NAME___contract/Counter")
|
|
9
|
+
.with_private_initializer(owner, Counter::interface().constructor(initial_value, owner));
|
|
10
|
+
|
|
11
|
+
(env, contract_address, owner)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#[test]
|
|
15
|
+
unconstrained fn test_constructor() {
|
|
16
|
+
let initial_value = 5;
|
|
17
|
+
let (env, contract_address, owner) = setup(initial_value);
|
|
18
|
+
|
|
19
|
+
let counter = env.execute_utility(Counter::at(contract_address).get_counter(owner));
|
|
20
|
+
assert_eq(counter, initial_value);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
#[test]
|
|
24
|
+
unconstrained fn test_increment() {
|
|
25
|
+
let initial_value = 5;
|
|
26
|
+
let (mut env, contract_address, owner) = setup(initial_value);
|
|
27
|
+
|
|
28
|
+
env.call_private(owner, Counter::at(contract_address).increment(owner));
|
|
29
|
+
|
|
30
|
+
let counter = env.execute_utility(Counter::at(contract_address).get_counter(owner));
|
|
31
|
+
assert_eq(counter, initial_value + 1);
|
|
32
|
+
}
|
|
@@ -81,7 +81,7 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
81
81
|
await startProverBroker(options, signalHandlers, services, userLog);
|
|
82
82
|
} else if (options.txe) {
|
|
83
83
|
const { startTXE } = await import('./cmds/start_txe.js');
|
|
84
|
-
await startTXE(options, debugLogger);
|
|
84
|
+
await startTXE(options, signalHandlers, debugLogger);
|
|
85
85
|
} else if (options.sequencer) {
|
|
86
86
|
userLog(`Cannot run a standalone sequencer without a node`);
|
|
87
87
|
process.exit(1);
|
|
@@ -326,15 +326,7 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
|
|
|
326
326
|
},
|
|
327
327
|
...getOptions('bot', botConfigMappings),
|
|
328
328
|
],
|
|
329
|
-
PXE: [
|
|
330
|
-
{
|
|
331
|
-
flag: '--pxe',
|
|
332
|
-
description: 'Starts Aztec PXE with options',
|
|
333
|
-
defaultValue: undefined,
|
|
334
|
-
env: undefined,
|
|
335
|
-
},
|
|
336
|
-
...getOptions('pxe', allPxeConfigMappings),
|
|
337
|
-
],
|
|
329
|
+
PXE: [...getOptions('pxe', allPxeConfigMappings)],
|
|
338
330
|
TXE: [
|
|
339
331
|
{
|
|
340
332
|
flag: '--txe',
|
package/src/cli/cmds/profile.ts
CHANGED
|
@@ -11,8 +11,9 @@ export function injectProfileCommand(program: Command, log: LogFn): Command {
|
|
|
11
11
|
profile
|
|
12
12
|
.command('gates')
|
|
13
13
|
.argument('[target-dir]', 'Path to the compiled artifacts directory', './target')
|
|
14
|
+
.option('--json', 'Output gate counts as JSON instead of a table', false)
|
|
14
15
|
.description('Display gate counts for all compiled Aztec artifacts in a target directory.')
|
|
15
|
-
.action((targetDir: string) => profileGates(targetDir, log));
|
|
16
|
+
.action((targetDir: string, options: { json: boolean }) => profileGates(targetDir, options.json, log));
|
|
16
17
|
|
|
17
18
|
profile
|
|
18
19
|
.command('flamegraph')
|
|
@@ -6,12 +6,13 @@ import { execFile as execFileCb } from 'child_process';
|
|
|
6
6
|
import { rm } from 'fs/promises';
|
|
7
7
|
import { promisify } from 'util';
|
|
8
8
|
|
|
9
|
-
import { MAX_CONCURRENT, discoverArtifacts } from './profile_utils.js';
|
|
9
|
+
import { type DiscoveredArtifact, MAX_CONCURRENT, discoverArtifacts } from './profile_utils.js';
|
|
10
10
|
|
|
11
11
|
const execFile = promisify(execFileCb);
|
|
12
12
|
|
|
13
13
|
interface GateCountResult {
|
|
14
14
|
name: string;
|
|
15
|
+
type: DiscoveredArtifact['type'];
|
|
15
16
|
gateCount: number;
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -32,24 +33,39 @@ async function getGateCount(bb: string, artifactPath: string): Promise<number> {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
/** Profiles all compiled artifacts in a target directory and prints gate counts. */
|
|
35
|
-
export async function profileGates(targetDir: string, log: LogFn): Promise<void> {
|
|
36
|
+
export async function profileGates(targetDir: string, json: boolean, log: LogFn): Promise<void> {
|
|
36
37
|
const bb = process.env.BB ?? findBbBinary() ?? 'bb';
|
|
37
38
|
const { artifacts, tmpDir } = await discoverArtifacts(targetDir);
|
|
38
39
|
|
|
39
40
|
if (artifacts.length === 0) {
|
|
40
|
-
|
|
41
|
+
if (json) {
|
|
42
|
+
log('[]');
|
|
43
|
+
} else {
|
|
44
|
+
log('No artifacts found in target directory.');
|
|
45
|
+
}
|
|
41
46
|
return;
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
try {
|
|
45
50
|
const results: GateCountResult[] = await asyncPool(MAX_CONCURRENT, artifacts, async artifact => ({
|
|
46
51
|
name: artifact.name,
|
|
52
|
+
type: artifact.type,
|
|
47
53
|
gateCount: await getGateCount(bb, artifact.filePath),
|
|
48
54
|
}));
|
|
49
55
|
results.sort((a, b) => a.name.localeCompare(b.name));
|
|
50
56
|
|
|
51
57
|
if (results.length === 0) {
|
|
52
|
-
|
|
58
|
+
if (json) {
|
|
59
|
+
log('[]');
|
|
60
|
+
} else {
|
|
61
|
+
log('No constrained circuits found.');
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (json) {
|
|
67
|
+
const entries = results.map(r => ({ name: r.name, type: r.type, gates: r.gateCount }));
|
|
68
|
+
log(JSON.stringify(entries, null, 2));
|
|
53
69
|
return;
|
|
54
70
|
}
|
|
55
71
|
|
|
@@ -24,8 +24,8 @@ export async function startProverAgent(
|
|
|
24
24
|
services: NamespacedApiHandlers,
|
|
25
25
|
userLog: LogFn,
|
|
26
26
|
) {
|
|
27
|
-
if (options.node || options.sequencer || options.
|
|
28
|
-
userLog(`Starting a prover agent with --node, --sequencer, --
|
|
27
|
+
if (options.node || options.sequencer || options.p2pBootstrap || options.txe) {
|
|
28
|
+
userLog(`Starting a prover agent with --node, --sequencer, --p2p-bootstrap, or --txe is not supported.`);
|
|
29
29
|
process.exit(1);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -24,8 +24,8 @@ export async function startProverBroker(
|
|
|
24
24
|
services: NamespacedApiHandlers,
|
|
25
25
|
userLog: LogFn,
|
|
26
26
|
): Promise<{ broker: ProvingJobBroker; config: ProverBrokerConfig }> {
|
|
27
|
-
if (options.node || options.sequencer || options.
|
|
28
|
-
userLog(`Starting a prover broker with --node, --sequencer, --
|
|
27
|
+
if (options.node || options.sequencer || options.p2pBootstrap || options.txe) {
|
|
28
|
+
userLog(`Starting a prover broker with --node, --sequencer, --p2p-bootstrap, or --txe is not supported.`);
|
|
29
29
|
process.exit(1);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -2,14 +2,16 @@ import { startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
3
|
import { createTXERpcServer } from '@aztec/txe';
|
|
4
4
|
|
|
5
|
-
export async function startTXE(options: any, debugLogger: Logger) {
|
|
5
|
+
export async function startTXE(options: any, signalHandlers: Array<() => Promise<void>>, debugLogger: Logger) {
|
|
6
6
|
debugLogger.info(`Setting up TXE...`);
|
|
7
7
|
|
|
8
8
|
const txeServer = createTXERpcServer(debugLogger);
|
|
9
|
-
const
|
|
9
|
+
const httpServer = await startHttpRpcServer(txeServer, {
|
|
10
10
|
port: options.port,
|
|
11
11
|
timeoutMs: 1e3 * 60 * 5,
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
signalHandlers.push(() => new Promise<void>(resolve => httpServer.close(() => resolve())));
|
|
15
|
+
|
|
16
|
+
debugLogger.info(`TXE listening on port ${httpServer.port}`);
|
|
15
17
|
}
|