@aztec/aztec 0.0.1-commit.cf93bcc56 → 0.0.1-commit.d0fcfb7f
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/bin/index.js +7 -3
- package/dest/cli/admin_api_key_store.d.ts +3 -3
- package/dest/cli/admin_api_key_store.d.ts.map +1 -1
- package/dest/cli/admin_api_key_store.js +3 -3
- package/dest/cli/aztec_start_action.d.ts +1 -1
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +15 -10
- package/dest/cli/aztec_start_options.js +5 -5
- package/dest/cli/cli.d.ts +1 -1
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +0 -1
- package/dest/cli/cmds/compile.d.ts +4 -0
- package/dest/cli/cmds/compile.d.ts.map +1 -0
- package/dest/cli/cmds/compile.js +68 -0
- package/dest/cli/cmds/profile.d.ts +4 -0
- package/dest/cli/cmds/profile.d.ts.map +1 -0
- package/dest/cli/cmds/profile.js +8 -0
- package/dest/cli/cmds/profile_flamegraph.d.ts +4 -0
- package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -0
- package/dest/cli/cmds/profile_flamegraph.js +51 -0
- package/dest/cli/cmds/profile_gates.d.ts +4 -0
- package/dest/cli/cmds/profile_gates.d.ts.map +1 -0
- package/dest/cli/cmds/profile_gates.js +57 -0
- package/dest/cli/cmds/profile_utils.d.ts +18 -0
- package/dest/cli/cmds/profile_utils.d.ts.map +1 -0
- package/dest/cli/cmds/profile_utils.js +50 -0
- package/dest/cli/cmds/standby.d.ts +32 -0
- package/dest/cli/cmds/standby.d.ts.map +1 -0
- package/dest/cli/cmds/standby.js +97 -0
- package/dest/cli/cmds/start_node.d.ts +3 -2
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +21 -17
- package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
- package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_broker.js +12 -6
- package/dest/cli/cmds/utils/artifacts.d.ts +21 -0
- package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -0
- package/dest/cli/cmds/utils/artifacts.js +24 -0
- package/dest/cli/cmds/utils/spawn.d.ts +3 -0
- package/dest/cli/cmds/utils/spawn.d.ts.map +1 -0
- package/dest/cli/cmds/utils/spawn.js +16 -0
- package/dest/cli/util.d.ts +3 -5
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +37 -78
- package/dest/examples/token.js +4 -4
- package/dest/local-network/banana_fpc.js +1 -1
- package/dest/local-network/local-network.d.ts +1 -1
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +35 -6
- package/dest/testing/anvil_test_watcher.d.ts +9 -1
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +52 -15
- package/dest/testing/epoch_test_settler.d.ts +1 -1
- package/dest/testing/epoch_test_settler.d.ts.map +1 -1
- package/dest/testing/epoch_test_settler.js +3 -4
- package/dest/testing/index.d.ts +2 -1
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +1 -0
- package/dest/testing/token_allowed_setup.d.ts +7 -0
- package/dest/testing/token_allowed_setup.d.ts.map +1 -0
- package/dest/testing/token_allowed_setup.js +20 -0
- package/package.json +34 -34
- package/scripts/aztec.sh +7 -3
- package/src/bin/index.ts +7 -3
- package/src/cli/admin_api_key_store.ts +4 -4
- package/src/cli/aztec_start_action.ts +13 -10
- package/src/cli/aztec_start_options.ts +5 -5
- package/src/cli/cli.ts +0 -1
- package/src/cli/cmds/compile.ts +80 -0
- package/src/cli/cmds/profile.ts +25 -0
- package/src/cli/cmds/profile_flamegraph.ts +63 -0
- package/src/cli/cmds/profile_gates.ts +67 -0
- package/src/cli/cmds/profile_utils.ts +58 -0
- package/src/cli/cmds/standby.ts +132 -0
- package/src/cli/cmds/start_node.ts +32 -24
- package/src/cli/cmds/start_prover_broker.ts +14 -14
- package/src/cli/cmds/utils/artifacts.ts +44 -0
- package/src/cli/cmds/utils/spawn.ts +16 -0
- package/src/cli/util.ts +41 -74
- package/src/examples/token.ts +6 -4
- package/src/local-network/banana_fpc.ts +1 -1
- package/src/local-network/local-network.ts +33 -4
- package/src/testing/anvil_test_watcher.ts +59 -15
- package/src/testing/epoch_test_settler.ts +3 -4
- package/src/testing/index.ts +1 -0
- package/src/testing/token_allowed_setup.ts +19 -0
- package/dest/cli/release_version.d.ts +0 -2
- package/dest/cli/release_version.d.ts.map +0 -1
- package/dest/cli/release_version.js +0 -14
- package/scripts/compile.sh +0 -44
- package/scripts/extract_function.js +0 -47
- package/scripts/flamegraph.sh +0 -59
- package/src/cli/release_version.ts +0 -21
package/dest/bin/index.js
CHANGED
|
@@ -11,10 +11,12 @@ import { injectCommands as injectMiscCommands } from '@aztec/cli/misc';
|
|
|
11
11
|
import { injectCommands as injectValidatorKeysCommands } from '@aztec/cli/validator_keys';
|
|
12
12
|
import { getActiveNetworkName } from '@aztec/foundation/config';
|
|
13
13
|
import { createConsoleLogger, createLogger } from '@aztec/foundation/log';
|
|
14
|
+
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
14
15
|
import { Command } from 'commander';
|
|
16
|
+
import { injectCompileCommand } from '../cli/cmds/compile.js';
|
|
15
17
|
import { injectMigrateCommand } from '../cli/cmds/migrate_ha_db.js';
|
|
18
|
+
import { injectProfileCommand } from '../cli/cmds/profile.js';
|
|
16
19
|
import { injectAztecCommands } from '../cli/index.js';
|
|
17
|
-
import { getCliVersion } from '../cli/release_version.js';
|
|
18
20
|
const NETWORK_FLAG = 'network';
|
|
19
21
|
const userLog = createConsoleLogger();
|
|
20
22
|
const debugLogger = createLogger('cli');
|
|
@@ -34,9 +36,9 @@ const debugLogger = createLogger('cli');
|
|
|
34
36
|
const networkName = getActiveNetworkName(networkValue);
|
|
35
37
|
await enrichEnvironmentWithNetworkConfig(networkName);
|
|
36
38
|
enrichEnvironmentWithChainName(networkName);
|
|
37
|
-
const cliVersion =
|
|
39
|
+
const cliVersion = getPackageVersion() ?? 'unknown';
|
|
38
40
|
let program = new Command('aztec');
|
|
39
|
-
program.description('Aztec command line interface').version(cliVersion);
|
|
41
|
+
program.description('Aztec command line interface').version(cliVersion).enablePositionalOptions();
|
|
40
42
|
program = injectAztecCommands(program, userLog, debugLogger);
|
|
41
43
|
program = injectBuilderCommands(program);
|
|
42
44
|
program = injectContractCommands(program, userLog, debugLogger);
|
|
@@ -45,6 +47,8 @@ const debugLogger = createLogger('cli');
|
|
|
45
47
|
program = injectAztecNodeCommands(program, userLog, debugLogger);
|
|
46
48
|
program = injectMiscCommands(program, userLog);
|
|
47
49
|
program = injectValidatorKeysCommands(program, userLog);
|
|
50
|
+
program = injectCompileCommand(program, userLog);
|
|
51
|
+
program = injectProfileCommand(program, userLog);
|
|
48
52
|
program = injectMigrateCommand(program, userLog);
|
|
49
53
|
await program.parseAsync(process.argv);
|
|
50
54
|
}
|
|
@@ -17,7 +17,7 @@ export interface ResolveAdminApiKeyOptions {
|
|
|
17
17
|
/** SHA-256 hex hash of a pre-generated API key. When set, the node uses this hash directly. */
|
|
18
18
|
adminApiKeyHash?: string;
|
|
19
19
|
/** If true, disable admin API key auth entirely. */
|
|
20
|
-
|
|
20
|
+
disableAdminApiKey?: boolean;
|
|
21
21
|
/** If true, force-generate a new key even if one is already persisted. */
|
|
22
22
|
resetAdminApiKey?: boolean;
|
|
23
23
|
/** Root data directory for persistent storage. */
|
|
@@ -27,7 +27,7 @@ export interface ResolveAdminApiKeyOptions {
|
|
|
27
27
|
* Resolves the admin API key for the admin RPC endpoint.
|
|
28
28
|
*
|
|
29
29
|
* Strategy:
|
|
30
|
-
* 1. If opt-out flag is set (`
|
|
30
|
+
* 1. If opt-out flag is set (`disableAdminApiKey`), return undefined (no auth).
|
|
31
31
|
* 2. If a pre-generated hash is provided (`adminApiKeyHash`), use it directly.
|
|
32
32
|
* 3. If a data directory exists, look for a persisted hash file
|
|
33
33
|
* at `<dataDirectory>/admin/api_key_hash`:
|
|
@@ -42,4 +42,4 @@ export interface ResolveAdminApiKeyOptions {
|
|
|
42
42
|
* @returns The resolved API key hash, or undefined if auth is disabled.
|
|
43
43
|
*/
|
|
44
44
|
export declare function resolveAdminApiKey(options: ResolveAdminApiKeyOptions, log: Logger): Promise<AdminApiKeyResolution | undefined>;
|
|
45
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRtaW5fYXBpX2tleV9zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS9hZG1pbl9hcGlfa2V5X3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBU3BEOzs7O0dBSUc7QUFDSCxNQUFNLFdBQVcscUJBQXFCO0lBQ3BDLHVDQUF1QztJQUN2QyxVQUFVLEVBQUUsTUFBTSxDQUFDO0lBQ25COzs7T0FHRztJQUNILE1BQU0sQ0FBQyxFQUFFLE1BQU0sQ0FBQztDQUNqQjtBQUVELE1BQU0sV0FBVyx5QkFBeUI7SUFDeEMsK0ZBQStGO0lBQy9GLGVBQWUsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUN6QixvREFBb0Q7SUFDcEQsa0JBQWtCLENBQUMsRUFBRSxPQUFPLENBQUM7SUFDN0IsMEVBQTBFO0lBQzFFLGdCQUFnQixDQUFDLEVBQUUsT0FBTyxDQUFDO0lBQzNCLGtEQUFrRDtJQUNsRCxhQUFhLENBQUMsRUFBRSxNQUFNLENBQUM7Q0FDeEI7QUFFRDs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FpQkc7QUFDSCx3QkFBc0Isa0JBQWtCLENBQ3RDLE9BQU8sRUFBRSx5QkFBeUIsRUFDbEMsR0FBRyxFQUFFLE1BQU0sR0FDVixPQUFPLENBQUMscUJBQXFCLEdBQUcsU0FBUyxDQUFDLENBMkQ1QyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_api_key_store.d.ts","sourceRoot":"","sources":["../../src/cli/admin_api_key_store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AASpD;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,yBAAyB;IACxC,+FAA+F;IAC/F,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,
|
|
1
|
+
{"version":3,"file":"admin_api_key_store.d.ts","sourceRoot":"","sources":["../../src/cli/admin_api_key_store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AASpD;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,yBAAyB;IACxC,+FAA+F;IAC/F,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,yBAAyB,EAClC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CA2D5C"}
|
|
@@ -8,7 +8,7 @@ const HASH_FILE_NAME = 'api_key_hash';
|
|
|
8
8
|
* Resolves the admin API key for the admin RPC endpoint.
|
|
9
9
|
*
|
|
10
10
|
* Strategy:
|
|
11
|
-
* 1. If opt-out flag is set (`
|
|
11
|
+
* 1. If opt-out flag is set (`disableAdminApiKey`), return undefined (no auth).
|
|
12
12
|
* 2. If a pre-generated hash is provided (`adminApiKeyHash`), use it directly.
|
|
13
13
|
* 3. If a data directory exists, look for a persisted hash file
|
|
14
14
|
* at `<dataDirectory>/admin/api_key_hash`:
|
|
@@ -23,8 +23,8 @@ const HASH_FILE_NAME = 'api_key_hash';
|
|
|
23
23
|
* @returns The resolved API key hash, or undefined if auth is disabled.
|
|
24
24
|
*/ export async function resolveAdminApiKey(options, log) {
|
|
25
25
|
// Operator explicitly opted out of admin auth
|
|
26
|
-
if (options.
|
|
27
|
-
log.warn('Admin API key authentication is DISABLED (--
|
|
26
|
+
if (options.disableAdminApiKey) {
|
|
27
|
+
log.warn('Admin API key authentication is DISABLED (--disable-admin-api-key / AZTEC_DISABLE_ADMIN_API_KEY)');
|
|
28
28
|
return undefined;
|
|
29
29
|
}
|
|
30
30
|
// Operator provided a pre-generated hash (e.g. via AZTEC_ADMIN_API_KEY_HASH env var)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
2
|
export declare function aztecStart(options: any, userLog: LogFn, debugLogger: Logger): Promise<void>;
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXp0ZWNfc3RhcnRfYWN0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL2F6dGVjX3N0YXJ0X2FjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFhM0Qsd0JBQXNCLFVBQVUsQ0FBQyxPQUFPLEVBQUUsR0FBRyxFQUFFLE9BQU8sRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0saUJBMElqRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aztec_start_action.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aztec_start_action.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_action.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAa3D,wBAAsB,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBA0IjF"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { getActiveNetworkName } from '@aztec/foundation/config';
|
|
1
2
|
import { createNamespacedSafeJsonRpcServer, getApiKeyAuthMiddleware, startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
2
3
|
import { AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
4
|
+
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
3
5
|
import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
|
|
4
6
|
import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
|
|
5
7
|
import { createLocalNetwork } from '../local-network/index.js';
|
|
6
8
|
import { github, splash } from '../splash.js';
|
|
7
9
|
import { resolveAdminApiKey } from './admin_api_key_store.js';
|
|
8
|
-
import { getCliVersion } from './release_version.js';
|
|
9
10
|
import { extractNamespacedOptions, installSignalHandlers } from './util.js';
|
|
10
11
|
import { getVersions } from './versioning.js';
|
|
11
12
|
export async function aztecStart(options, userLog, debugLogger) {
|
|
@@ -13,23 +14,23 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
13
14
|
const signalHandlers = [];
|
|
14
15
|
const services = {};
|
|
15
16
|
const adminServices = {};
|
|
17
|
+
const packageVersion = getPackageVersion();
|
|
16
18
|
let config = undefined;
|
|
17
19
|
if (options.localNetwork) {
|
|
18
|
-
const cliVersion = getCliVersion();
|
|
19
20
|
const localNetwork = extractNamespacedOptions(options, 'local-network');
|
|
20
21
|
localNetwork.testAccounts = true;
|
|
21
22
|
userLog(`${splash}\n${github}\n\n`);
|
|
22
|
-
userLog(`Setting up Aztec local network ${
|
|
23
|
+
userLog(`Setting up Aztec local network ${packageVersion ?? 'unknown'}, please stand by...`);
|
|
23
24
|
const { node, stop } = await createLocalNetwork({
|
|
24
25
|
l1Mnemonic: localNetwork.l1Mnemonic,
|
|
25
26
|
l1RpcUrls: options.l1RpcUrls,
|
|
26
27
|
testAccounts: localNetwork.testAccounts,
|
|
27
28
|
realProofs: false,
|
|
28
|
-
// Setting the epoch duration to
|
|
29
|
+
// Setting the epoch duration to 2 by default for local network. This allows the epoch to be "proven" faster, so
|
|
29
30
|
// the users can consume out hash without having to wait for a long time.
|
|
30
31
|
// Note: We are not proving anything in the local network (realProofs == false). But in `createLocalNetwork`,
|
|
31
32
|
// the EpochTestSettler will set the out hash to the outbox when an epoch is complete.
|
|
32
|
-
aztecEpochDuration:
|
|
33
|
+
aztecEpochDuration: 2
|
|
33
34
|
}, userLog);
|
|
34
35
|
// Start Node and PXE JSON-RPC server
|
|
35
36
|
signalHandlers.push(stop);
|
|
@@ -44,7 +45,8 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
44
45
|
}
|
|
45
46
|
if (options.node) {
|
|
46
47
|
const { startNode } = await import('./cmds/start_node.js');
|
|
47
|
-
|
|
48
|
+
const networkName = getActiveNetworkName(options.network);
|
|
49
|
+
({ config } = await startNode(options, signalHandlers, services, adminServices, userLog, networkName));
|
|
48
50
|
} else if (options.bot) {
|
|
49
51
|
const { startBot } = await import('./cmds/start_bot.js');
|
|
50
52
|
await startBot(options, signalHandlers, services, userLog);
|
|
@@ -73,6 +75,9 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
73
75
|
}
|
|
74
76
|
installSignalHandlers(debugLogger.info, signalHandlers);
|
|
75
77
|
const versions = getVersions(config);
|
|
78
|
+
const versioningOpts = {
|
|
79
|
+
packageVersion
|
|
80
|
+
};
|
|
76
81
|
// Start the main JSON-RPC server
|
|
77
82
|
if (Object.entries(services).length > 0) {
|
|
78
83
|
const rpcServer = createNamespacedSafeJsonRpcServer(services, {
|
|
@@ -80,7 +85,7 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
80
85
|
log: debugLogger,
|
|
81
86
|
middlewares: [
|
|
82
87
|
getOtelJsonRpcPropagationMiddleware(),
|
|
83
|
-
getVersioningMiddleware(versions)
|
|
88
|
+
getVersioningMiddleware(versions, versioningOpts)
|
|
84
89
|
],
|
|
85
90
|
maxBatchSize: options.rpcMaxBatchSize,
|
|
86
91
|
maxBodySizeBytes: options.rpcMaxBodySize
|
|
@@ -94,12 +99,12 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
94
99
|
if (Object.entries(adminServices).length > 0) {
|
|
95
100
|
const adminMiddlewares = [
|
|
96
101
|
getOtelJsonRpcPropagationMiddleware(),
|
|
97
|
-
getVersioningMiddleware(versions)
|
|
102
|
+
getVersioningMiddleware(versions, versioningOpts)
|
|
98
103
|
];
|
|
99
104
|
// Resolve the admin API key (auto-generated and persisted, or opt-out)
|
|
100
105
|
const apiKeyResolution = await resolveAdminApiKey({
|
|
101
106
|
adminApiKeyHash: options.adminApiKeyHash,
|
|
102
|
-
|
|
107
|
+
disableAdminApiKey: options.disableAdminApiKey,
|
|
103
108
|
resetAdminApiKey: options.resetAdminApiKey,
|
|
104
109
|
dataDirectory: options.dataDirectory
|
|
105
110
|
}, debugLogger);
|
|
@@ -136,7 +141,7 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
136
141
|
userLog(' The key hash has been persisted — on next restart, the same key will be used.');
|
|
137
142
|
}
|
|
138
143
|
userLog('');
|
|
139
|
-
userLog(' To disable admin auth: --
|
|
144
|
+
userLog(' To disable admin auth: --disable-admin-api-key or AZTEC_DISABLE_ADMIN_API_KEY=true');
|
|
140
145
|
userLog(separator);
|
|
141
146
|
userLog('');
|
|
142
147
|
}
|
|
@@ -76,8 +76,7 @@ export const aztecStartOptions = {
|
|
|
76
76
|
defaultValue: undefined,
|
|
77
77
|
env: 'NETWORK'
|
|
78
78
|
},
|
|
79
|
-
configToFlag('--
|
|
80
|
-
configToFlag('--auto-update-url', sharedNodeConfigMappings.autoUpdateUrl),
|
|
79
|
+
configToFlag('--enable-version-check', sharedNodeConfigMappings.enableVersionCheck),
|
|
81
80
|
configToFlag('--sync-mode', sharedNodeConfigMappings.syncMode),
|
|
82
81
|
configToFlag('--snapshots-urls', sharedNodeConfigMappings.snapshotsUrls),
|
|
83
82
|
configToFlag('--fisherman-mode', sharedNodeConfigMappings.fishermanMode)
|
|
@@ -118,11 +117,12 @@ export const aztecStartOptions = {
|
|
|
118
117
|
env: 'AZTEC_ADMIN_API_KEY_HASH'
|
|
119
118
|
},
|
|
120
119
|
{
|
|
121
|
-
flag: '--
|
|
120
|
+
flag: '--disable-admin-api-key',
|
|
122
121
|
description: 'Disable API key authentication on the admin RPC endpoint. By default, a key is auto-generated, displayed once, and its hash is persisted.',
|
|
123
122
|
defaultValue: false,
|
|
124
|
-
env: '
|
|
125
|
-
|
|
123
|
+
env: 'AZTEC_DISABLE_ADMIN_API_KEY',
|
|
124
|
+
// undefined means the flag was passed without a value (boolean toggle), treat as true.
|
|
125
|
+
parseVal: (val)=>val === undefined || val === 'true' || val === '1'
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
flag: '--reset-admin-api-key',
|
package/dest/cli/cli.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ import { Command } from 'commander';
|
|
|
6
6
|
* @param debugLogger - logger for logging debug messages.
|
|
7
7
|
*/
|
|
8
8
|
export declare function injectAztecCommands(program: Command, userLog: LogFn, debugLogger: Logger): Command;
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL2NsaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFM0QsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLFdBQVcsQ0FBQztBQUtwQzs7OztHQUlHO0FBQ0gsd0JBQWdCLG1CQUFtQixDQUFDLE9BQU8sRUFBRSxPQUFPLEVBQUUsT0FBTyxFQUFFLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0EyQ2xHIn0=
|
package/dest/cli/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CA2ClG"}
|
package/dest/cli/cli.js
CHANGED
|
@@ -26,7 +26,6 @@ Additional commands:
|
|
|
26
26
|
|
|
27
27
|
init [folder] [options] creates a new Aztec Noir project.
|
|
28
28
|
new <path> [options] creates a new Aztec Noir project in a new directory.
|
|
29
|
-
compile [options] compiles Aztec Noir contracts.
|
|
30
29
|
test [options] starts a TXE and runs "nargo test" using it as the oracle resolver.
|
|
31
30
|
`);
|
|
32
31
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
+
import type { Command } from 'commander';
|
|
3
|
+
export declare function injectCompileCommand(program: Command, log: LogFn): Command;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGlsZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL2NvbXBpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFHbkQsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBc0R6Qyx3QkFBZ0Isb0JBQW9CLENBQUMsT0FBTyxFQUFFLE9BQU8sRUFBRSxHQUFHLEVBQUUsS0FBSyxHQUFHLE9BQU8sQ0FzQjFFIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/compile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsDzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAsB1E"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { execFileSync } from 'child_process';
|
|
2
|
+
import { readFile, writeFile } from 'fs/promises';
|
|
3
|
+
import { readArtifactFiles } from './utils/artifacts.js';
|
|
4
|
+
import { run } from './utils/spawn.js';
|
|
5
|
+
/** Returns paths to contract artifacts in the target directory. */ async function collectContractArtifacts() {
|
|
6
|
+
let files;
|
|
7
|
+
try {
|
|
8
|
+
files = await readArtifactFiles('target');
|
|
9
|
+
} catch (err) {
|
|
10
|
+
if (err?.message?.includes('does not exist')) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
throw err;
|
|
14
|
+
}
|
|
15
|
+
return files.filter((f)=>Array.isArray(f.content.functions)).map((f)=>f.filePath);
|
|
16
|
+
}
|
|
17
|
+
/** Strips the `__aztec_nr_internals__` prefix from function names in contract artifacts. */ async function stripInternalPrefixes(artifactPaths) {
|
|
18
|
+
for (const path of artifactPaths){
|
|
19
|
+
const artifact = JSON.parse(await readFile(path, 'utf-8'));
|
|
20
|
+
for (const fn of artifact.functions){
|
|
21
|
+
if (typeof fn.name === 'string') {
|
|
22
|
+
fn.name = fn.name.replace(/^__aztec_nr_internals__/, '');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
await writeFile(path, JSON.stringify(artifact, null, 2) + '\n');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Compiles Aztec Noir contracts and postprocesses artifacts. */ async function compileAztecContract(nargoArgs, log) {
|
|
29
|
+
const nargo = process.env.NARGO ?? 'nargo';
|
|
30
|
+
const bb = process.env.BB ?? 'bb';
|
|
31
|
+
await run(nargo, [
|
|
32
|
+
'compile',
|
|
33
|
+
...nargoArgs
|
|
34
|
+
]);
|
|
35
|
+
const artifacts = await collectContractArtifacts();
|
|
36
|
+
if (artifacts.length > 0) {
|
|
37
|
+
log('Postprocessing contracts...');
|
|
38
|
+
const bbArgs = artifacts.flatMap((a)=>[
|
|
39
|
+
'-i',
|
|
40
|
+
a
|
|
41
|
+
]);
|
|
42
|
+
await run(bb, [
|
|
43
|
+
'aztec_process',
|
|
44
|
+
...bbArgs
|
|
45
|
+
]);
|
|
46
|
+
// TODO: This should be part of bb aztec_process!
|
|
47
|
+
await stripInternalPrefixes(artifacts);
|
|
48
|
+
}
|
|
49
|
+
log('Compilation complete!');
|
|
50
|
+
}
|
|
51
|
+
export function injectCompileCommand(program, log) {
|
|
52
|
+
program.command('compile').argument('[nargo-args...]').passThroughOptions().allowUnknownOption().description('Compile Aztec Noir contracts using nargo and postprocess them to generate transpiled artifacts and verification keys. All options are forwarded to nargo compile.').addHelpText('after', ()=>{
|
|
53
|
+
// Show nargo's own compile options so users see all available flags in one place.
|
|
54
|
+
const nargo = process.env.NARGO ?? 'nargo';
|
|
55
|
+
try {
|
|
56
|
+
const output = execFileSync(nargo, [
|
|
57
|
+
'compile',
|
|
58
|
+
'--help'
|
|
59
|
+
], {
|
|
60
|
+
encoding: 'utf-8'
|
|
61
|
+
});
|
|
62
|
+
return `\nUnderlying nargo compile options:\n\n${output}`;
|
|
63
|
+
} catch {
|
|
64
|
+
return '\n(Run "nargo compile --help" to see available nargo options)';
|
|
65
|
+
}
|
|
66
|
+
}).action((nargoArgs)=>compileAztecContract(nargoArgs, log));
|
|
67
|
+
return program;
|
|
68
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
+
import type { Command } from 'commander';
|
|
3
|
+
export declare function injectProfileCommand(program: Command, log: LogFn): Command;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3Byb2ZpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFbkQsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBS3pDLHdCQUFnQixvQkFBb0IsQ0FBQyxPQUFPLEVBQUUsT0FBTyxFQUFFLEdBQUcsRUFBRSxLQUFLLEdBQUcsT0FBTyxDQWlCMUUifQ==
|
|
@@ -0,0 +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,CAiB1E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { profileFlamegraph } from './profile_flamegraph.js';
|
|
2
|
+
import { profileGates } from './profile_gates.js';
|
|
3
|
+
export function injectProfileCommand(program, log) {
|
|
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));
|
|
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
|
+
return program;
|
|
8
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
+
/** Generates a gate count flamegraph SVG for a single contract function. */
|
|
3
|
+
export declare function profileFlamegraph(artifactPath: string, functionName: string, log: LogFn): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZV9mbGFtZWdyYXBoLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2NtZHMvcHJvZmlsZV9mbGFtZWdyYXBoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBU25ELDRFQUE0RTtBQUM1RSx3QkFBc0IsaUJBQWlCLENBQUMsWUFBWSxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsTUFBTSxFQUFFLEdBQUcsRUFBRSxLQUFLLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQW9EN0cifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile_flamegraph.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile_flamegraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AASnD,4EAA4E;AAC5E,wBAAsB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAoD7G"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { readFile, rename, rm, writeFile } from 'fs/promises';
|
|
2
|
+
import { basename, dirname, join } from 'path';
|
|
3
|
+
import { makeFunctionArtifact } from './profile_utils.js';
|
|
4
|
+
import { run } from './utils/spawn.js';
|
|
5
|
+
/** Generates a gate count flamegraph SVG for a single contract function. */ export async function profileFlamegraph(artifactPath, functionName, log) {
|
|
6
|
+
const raw = await readFile(artifactPath, 'utf-8');
|
|
7
|
+
const artifact = JSON.parse(raw);
|
|
8
|
+
if (!Array.isArray(artifact.functions)) {
|
|
9
|
+
throw new Error(`${artifactPath} does not appear to be a contract artifact (no functions array)`);
|
|
10
|
+
}
|
|
11
|
+
const func = artifact.functions.find((f)=>f.name === functionName);
|
|
12
|
+
if (!func) {
|
|
13
|
+
const available = artifact.functions.map((f)=>f.name).join(', ');
|
|
14
|
+
throw new Error(`Function "${functionName}" not found in artifact. Available: ${available}`);
|
|
15
|
+
}
|
|
16
|
+
if (func.is_unconstrained) {
|
|
17
|
+
throw new Error(`Function "${functionName}" is unconstrained and cannot be profiled`);
|
|
18
|
+
}
|
|
19
|
+
const outputDir = dirname(artifactPath);
|
|
20
|
+
const contractName = basename(artifactPath, '.json');
|
|
21
|
+
const functionArtifact = join(outputDir, `${contractName}-${functionName}.json`);
|
|
22
|
+
try {
|
|
23
|
+
await writeFile(functionArtifact, makeFunctionArtifact(artifact, func));
|
|
24
|
+
const profiler = process.env.PROFILER_PATH ?? 'noir-profiler';
|
|
25
|
+
const bb = process.env.BB ?? 'bb';
|
|
26
|
+
await run(profiler, [
|
|
27
|
+
'gates',
|
|
28
|
+
'--artifact-path',
|
|
29
|
+
functionArtifact,
|
|
30
|
+
'--backend-path',
|
|
31
|
+
bb,
|
|
32
|
+
'--backend-gates-command',
|
|
33
|
+
'gates',
|
|
34
|
+
'--output',
|
|
35
|
+
outputDir,
|
|
36
|
+
'--scheme',
|
|
37
|
+
'chonk',
|
|
38
|
+
'--include_gates_per_opcode'
|
|
39
|
+
]);
|
|
40
|
+
// noir-profiler names the SVG using the internal function name which
|
|
41
|
+
// retains the __aztec_nr_internals__ prefix in the bytecode metadata.
|
|
42
|
+
const srcSvg = join(outputDir, `__aztec_nr_internals__${functionName}_gates.svg`);
|
|
43
|
+
const destSvg = join(outputDir, `${contractName}-${functionName}-flamegraph.svg`);
|
|
44
|
+
await rename(srcSvg, destSvg);
|
|
45
|
+
log(`Flamegraph written to ${destSvg}`);
|
|
46
|
+
} finally{
|
|
47
|
+
await rm(functionArtifact, {
|
|
48
|
+
force: true
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZV9nYXRlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3Byb2ZpbGVfZ2F0ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUErQm5ELG9GQUFvRjtBQUNwRix3QkFBc0IsWUFBWSxDQUFDLFNBQVMsRUFBRSxNQUFNLEVBQUUsR0FBRyxFQUFFLEtBQUssR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBaUMvRSJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile_gates.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile_gates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AA+BnD,oFAAoF;AACpF,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAiC/E"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { asyncPool } from '@aztec/foundation/async-pool';
|
|
2
|
+
import { execFile as execFileCb } from 'child_process';
|
|
3
|
+
import { rm } from 'fs/promises';
|
|
4
|
+
import { promisify } from 'util';
|
|
5
|
+
import { MAX_CONCURRENT, discoverArtifacts } from './profile_utils.js';
|
|
6
|
+
const execFile = promisify(execFileCb);
|
|
7
|
+
/** Parses circuit_size from bb gates JSON output: { "functions": [{ "circuit_size": N }] } */ function parseGateCount(stdout) {
|
|
8
|
+
const parsed = JSON.parse(stdout);
|
|
9
|
+
const size = parsed?.functions?.[0]?.circuit_size;
|
|
10
|
+
if (typeof size !== 'number') {
|
|
11
|
+
throw new Error('Failed to parse circuit_size from bb gates output');
|
|
12
|
+
}
|
|
13
|
+
return size;
|
|
14
|
+
}
|
|
15
|
+
/** Runs bb gates on a single artifact file and returns the gate count. */ async function getGateCount(bb, artifactPath) {
|
|
16
|
+
const { stdout } = await execFile(bb, [
|
|
17
|
+
'gates',
|
|
18
|
+
'--scheme',
|
|
19
|
+
'chonk',
|
|
20
|
+
'-b',
|
|
21
|
+
artifactPath
|
|
22
|
+
]);
|
|
23
|
+
return parseGateCount(stdout);
|
|
24
|
+
}
|
|
25
|
+
/** Profiles all compiled artifacts in a target directory and prints gate counts. */ export async function profileGates(targetDir, log) {
|
|
26
|
+
const bb = process.env.BB ?? 'bb';
|
|
27
|
+
const { artifacts, tmpDir } = await discoverArtifacts(targetDir);
|
|
28
|
+
if (artifacts.length === 0) {
|
|
29
|
+
log('No artifacts found in target directory.');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const results = await asyncPool(MAX_CONCURRENT, artifacts, async (artifact)=>({
|
|
34
|
+
name: artifact.name,
|
|
35
|
+
gateCount: await getGateCount(bb, artifact.filePath)
|
|
36
|
+
}));
|
|
37
|
+
results.sort((a, b)=>a.name.localeCompare(b.name));
|
|
38
|
+
if (results.length === 0) {
|
|
39
|
+
log('No constrained circuits found.');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const maxNameLen = Math.max(...results.map((r)=>r.name.length));
|
|
43
|
+
log('');
|
|
44
|
+
log('Gate counts:');
|
|
45
|
+
log('-'.repeat(maxNameLen + 16));
|
|
46
|
+
for (const { name, gateCount } of results){
|
|
47
|
+
log(`${name.padEnd(maxNameLen)} ${gateCount.toLocaleString().padStart(12)}`);
|
|
48
|
+
}
|
|
49
|
+
log('-'.repeat(maxNameLen + 16));
|
|
50
|
+
log(`Total: ${results.length} circuit(s)`);
|
|
51
|
+
} finally{
|
|
52
|
+
await rm(tmpDir, {
|
|
53
|
+
recursive: true,
|
|
54
|
+
force: true
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CompiledArtifact, ContractFunction } from './utils/artifacts.js';
|
|
2
|
+
export declare const MAX_CONCURRENT = 4;
|
|
3
|
+
export interface DiscoveredArtifact {
|
|
4
|
+
name: string;
|
|
5
|
+
filePath: string;
|
|
6
|
+
type: 'contract-function' | 'program';
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Reads a target directory and returns a list of discovered artifacts with temp files
|
|
10
|
+
* created for contract functions. Caller must clean up tmpDir when done.
|
|
11
|
+
*/
|
|
12
|
+
export declare function discoverArtifacts(targetDir: string): Promise<{
|
|
13
|
+
artifacts: DiscoveredArtifact[];
|
|
14
|
+
tmpDir: string;
|
|
15
|
+
}>;
|
|
16
|
+
/** Extracts a contract function as a standalone program artifact JSON string. */
|
|
17
|
+
export declare function makeFunctionArtifact(artifact: CompiledArtifact, func: ContractFunction): string;
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZV91dGlscy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3Byb2ZpbGVfdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUcvRSxlQUFPLE1BQU0sY0FBYyxJQUFJLENBQUM7QUF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 'fs/promises';
|
|
2
|
+
import { tmpdir } from 'os';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { readArtifactFiles } from './utils/artifacts.js';
|
|
5
|
+
export const MAX_CONCURRENT = 4;
|
|
6
|
+
/**
|
|
7
|
+
* Reads a target directory and returns a list of discovered artifacts with temp files
|
|
8
|
+
* created for contract functions. Caller must clean up tmpDir when done.
|
|
9
|
+
*/ export async function discoverArtifacts(targetDir) {
|
|
10
|
+
const files = await readArtifactFiles(targetDir);
|
|
11
|
+
const tmpDir = await mkdtemp(join(tmpdir(), 'aztec-profile-'));
|
|
12
|
+
const artifacts = [];
|
|
13
|
+
for (const file of files){
|
|
14
|
+
if (Array.isArray(file.content.functions)) {
|
|
15
|
+
for (const func of file.content.functions){
|
|
16
|
+
if (!func.bytecode || func.is_unconstrained) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const name = `${file.name}::${func.name}`;
|
|
20
|
+
const tmpPath = join(tmpDir, `${file.name}-${func.name}.json`);
|
|
21
|
+
await writeFile(tmpPath, makeFunctionArtifact(file.content, func));
|
|
22
|
+
artifacts.push({
|
|
23
|
+
name,
|
|
24
|
+
filePath: tmpPath,
|
|
25
|
+
type: 'contract-function'
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
} else if (file.content.bytecode) {
|
|
29
|
+
artifacts.push({
|
|
30
|
+
name: file.name,
|
|
31
|
+
filePath: file.filePath,
|
|
32
|
+
type: 'program'
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
artifacts,
|
|
38
|
+
tmpDir
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Extracts a contract function as a standalone program artifact JSON string. */ export function makeFunctionArtifact(artifact, func) {
|
|
42
|
+
/* eslint-disable camelcase */ return JSON.stringify({
|
|
43
|
+
noir_version: artifact.noir_version,
|
|
44
|
+
hash: 0,
|
|
45
|
+
abi: func.abi,
|
|
46
|
+
bytecode: func.bytecode,
|
|
47
|
+
debug_symbols: func.debug_symbols,
|
|
48
|
+
file_map: artifact.file_map
|
|
49
|
+
});
|
|
50
|
+
/* eslint-enable camelcase */ }
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/aztec.js/fields';
|
|
2
|
+
import type { GenesisStateConfig } from '@aztec/ethereum/config';
|
|
3
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
5
|
+
/**
|
|
6
|
+
* Computes the expected genesis archive root from the genesis state config.
|
|
7
|
+
* Reads test accounts and sponsored FPC addresses as specified, then computes
|
|
8
|
+
* the genesis values including the archive root and prefilled public data.
|
|
9
|
+
*/
|
|
10
|
+
export declare function computeExpectedGenesisRoot(config: GenesisStateConfig, userLog: LogFn): Promise<{
|
|
11
|
+
genesisArchiveRoot: Fr;
|
|
12
|
+
prefilledPublicData: import("@aztec/stdlib/trees").PublicDataTreeLeaf[];
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Waits until the canonical rollup's genesis archive root, VK tree root, and protocol contracts hash
|
|
16
|
+
* all match the expected local values. If the rollup is not yet compatible (e.g. during L1 contract upgrades),
|
|
17
|
+
* enters standby mode: starts a lightweight HTTP server for K8s liveness probes and polls every 60s
|
|
18
|
+
* until a compatible rollup appears.
|
|
19
|
+
*/
|
|
20
|
+
export declare function waitForCompatibleRollup(config: {
|
|
21
|
+
l1RpcUrls: string[];
|
|
22
|
+
l1ChainId: number;
|
|
23
|
+
l1Contracts: {
|
|
24
|
+
registryAddress: EthAddress;
|
|
25
|
+
};
|
|
26
|
+
rollupVersion?: number;
|
|
27
|
+
}, expected: {
|
|
28
|
+
genesisArchiveRoot: Fr;
|
|
29
|
+
vkTreeRoot: Fr;
|
|
30
|
+
protocolContractsHash: Fr;
|
|
31
|
+
}, port: number | undefined, userLog: LogFn): Promise<void>;
|
|
32
|
+
//# sourceMappingURL=data:application/json;base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