@aztec/aztec 0.0.1-commit.7035c9bd6 → 0.0.1-commit.71324e566
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.d.ts +1 -1
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +12 -3
- package/dest/cli/aztec_start_options.d.ts +2 -2
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +13 -0
- package/dest/cli/cmds/compile.d.ts +1 -1
- package/dest/cli/cmds/compile.d.ts.map +1 -1
- package/dest/cli/cmds/compile.js +3 -14
- package/dest/cli/cmds/standby.d.ts +1 -1
- package/dest/cli/cmds/standby.js +2 -2
- package/dest/cli/cmds/start_archiver.d.ts +1 -1
- package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
- package/dest/cli/cmds/start_archiver.js +3 -1
- package/dest/cli/cmds/start_node.d.ts +1 -1
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +6 -20
- package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
- package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_agent.js +3 -15
- package/dest/cli/cmds/utils/collect_crate_dirs.d.ts +21 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.d.ts.map +1 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.js +114 -0
- package/dest/cli/cmds/utils/needs_recompile.d.ts +1 -1
- package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -1
- package/dest/cli/cmds/utils/needs_recompile.js +9 -53
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +4 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +62 -0
- package/dest/local-network/local-network.d.ts +3 -4
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +3 -3
- package/dest/testing/anvil_test_watcher.d.ts +1 -1
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +36 -10
- package/dest/testing/cheat_codes.d.ts +11 -15
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +34 -32
- package/package.json +33 -33
- package/scripts/aztec.sh +1 -1
- package/src/cli/aztec_start_action.ts +6 -3
- package/src/cli/aztec_start_options.ts +19 -2
- package/src/cli/cmds/compile.ts +4 -17
- package/src/cli/cmds/standby.ts +2 -2
- package/src/cli/cmds/start_archiver.ts +7 -1
- package/src/cli/cmds/start_node.ts +9 -11
- package/src/cli/cmds/start_prover_agent.ts +3 -6
- package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
- package/src/cli/cmds/utils/needs_recompile.ts +8 -61
- package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +77 -0
- package/src/local-network/local-network.ts +5 -5
- package/src/testing/anvil_test_watcher.ts +33 -10
- package/src/testing/cheat_codes.ts +42 -36
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXp0ZWNfc3RhcnRfYWN0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL2F6dGVjX3N0YXJ0X2FjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFhM0Qsd0JBQXNCLFVBQVUsQ0FBQyxPQUFPLEVBQUUsR0FBRyxFQUFFLE9BQU8sRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0saUJBOElqRiJ9
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,iBA8IjF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getActiveNetworkName } from '@aztec/foundation/config';
|
|
2
2
|
import { createNamespacedSafeJsonRpcServer, getApiKeyAuthMiddleware, startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
3
|
-
import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
3
|
+
import { AztecNodeAdminApiSchema, AztecNodeApiSchema, AztecNodeDebugApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
4
4
|
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
5
5
|
import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
|
|
6
6
|
import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
|
|
@@ -17,8 +17,7 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
17
17
|
const packageVersion = getPackageVersion();
|
|
18
18
|
let config = undefined;
|
|
19
19
|
if (options.localNetwork) {
|
|
20
|
-
const localNetwork = extractNamespacedOptions(options, '
|
|
21
|
-
localNetwork.testAccounts = true;
|
|
20
|
+
const localNetwork = extractNamespacedOptions(options, 'localNetwork');
|
|
22
21
|
userLog(`${splash}\n${github}\n\n`);
|
|
23
22
|
userLog(`Setting up Aztec local network ${packageVersion ?? 'unknown'}, please stand by...`);
|
|
24
23
|
const { node, stop } = await createLocalNetwork({
|
|
@@ -42,6 +41,10 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
42
41
|
node,
|
|
43
42
|
AztecNodeAdminApiSchema
|
|
44
43
|
];
|
|
44
|
+
services.nodeDebug = [
|
|
45
|
+
node,
|
|
46
|
+
AztecNodeDebugApiSchema
|
|
47
|
+
];
|
|
45
48
|
} else {
|
|
46
49
|
// Route --prover-node through startNode
|
|
47
50
|
if (options.proverNode && !options.node) {
|
|
@@ -51,6 +54,12 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
51
54
|
const { startNode } = await import('./cmds/start_node.js');
|
|
52
55
|
const networkName = getActiveNetworkName(options.network);
|
|
53
56
|
({ config } = await startNode(options, signalHandlers, services, adminServices, userLog, networkName));
|
|
57
|
+
if (options.nodeDebug && services.node) {
|
|
58
|
+
services.nodeDebug = [
|
|
59
|
+
services.node[0],
|
|
60
|
+
AztecNodeDebugApiSchema
|
|
61
|
+
];
|
|
62
|
+
}
|
|
54
63
|
} else if (options.bot) {
|
|
55
64
|
const { startBot } = await import('./cmds/start_bot.js');
|
|
56
65
|
await startBot(options, signalHandlers, services, userLog);
|
|
@@ -8,10 +8,10 @@ export interface AztecStartOption {
|
|
|
8
8
|
fallback?: EnvVar[];
|
|
9
9
|
parseVal?: (val: string) => any;
|
|
10
10
|
}
|
|
11
|
-
export declare const getOptions: (namespace: string, configMappings: Record<string, ConfigMapping
|
|
11
|
+
export declare const getOptions: (namespace: string, configMappings: Record<string, ConfigMapping<unknown>>) => AztecStartOption[];
|
|
12
12
|
export declare const universalOptions: string[];
|
|
13
13
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXp0ZWNfc3RhcnRfb3B0aW9ucy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS9henRlY19zdGFydF9vcHRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9BLE9BQU8sRUFDTCxLQUFLLGFBQWEsRUFDbEIsS0FBSyxNQUFNLEVBSVosTUFBTSwwQkFBMEIsQ0FBQztBQWVsQyxNQUFNLFdBQVcsZ0JBQWdCO0lBQy9CLElBQUksRUFBRSxNQUFNLENBQUM7SUFDYixXQUFXLEVBQUUsTUFBTSxDQUFDO0lBQ3BCLFlBQVksRUFBRSxHQUFHLENBQUM7SUFDbEIsWUFBWSxDQUFDLEVBQUUsQ0FBQyxHQUFHLEVBQUUsR0FBRyxLQUFLLE1BQU0sQ0FBQztJQUNwQyxHQUFHLEVBQUUsTUFBTSxHQUFHLFNBQVMsQ0FBQztJQUN4QixRQUFRLENBQUMsRUFBRSxNQUFNLEVBQUUsQ0FBQztJQUNwQixRQUFRLENBQUMsRUFBRSxDQUFDLEdBQUcsRUFBRSxNQUFNLEtBQUssR0FBRyxDQUFDO0NBQ2pDO0FBRUQsZUFBTyxNQUFNLFVBQVUsbUdBb0J0QixDQUFDO0FBMkJGLGVBQU8sTUFBTSxnQkFBZ0IsVUFZNUIsQ0FBQztBQUVGLGVBQU8sTUFBTSxZQUFZLFlBQVksQ0FBQztBQUd0QyxlQUFPLE1BQU0saUJBQWlCLEVBQUU7SUFBRSxDQUFDLEdBQUcsRUFBRSxNQUFNLEdBQUcsZ0JBQWdCLEVBQUUsQ0FBQTtDQW1QbEUsQ0FBQyJ9
|
|
@@ -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,
|
|
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;CAmPlE,CAAC"}
|
|
@@ -93,6 +93,12 @@ export const aztecStartOptions = {
|
|
|
93
93
|
description: 'Mnemonic for L1 accounts. Will be used ',
|
|
94
94
|
defaultValue: DefaultMnemonic,
|
|
95
95
|
env: 'MNEMONIC'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
flag: '--local-network.testAccounts',
|
|
99
|
+
description: 'Deploy test accounts on local network start',
|
|
100
|
+
env: 'TEST_ACCOUNTS',
|
|
101
|
+
...booleanConfigHelper(true)
|
|
96
102
|
}
|
|
97
103
|
],
|
|
98
104
|
API: [
|
|
@@ -131,6 +137,13 @@ export const aztecStartOptions = {
|
|
|
131
137
|
env: 'AZTEC_RESET_ADMIN_API_KEY',
|
|
132
138
|
parseVal: (val)=>val === 'true' || val === '1'
|
|
133
139
|
},
|
|
140
|
+
{
|
|
141
|
+
flag: '--node-debug',
|
|
142
|
+
description: 'Expose debug endpoints (e.g. mineBlock) on the main RPC port',
|
|
143
|
+
defaultValue: false,
|
|
144
|
+
env: 'AZTEC_NODE_DEBUG',
|
|
145
|
+
parseVal: (val)=>val === undefined || val === 'true' || val === '1'
|
|
146
|
+
},
|
|
134
147
|
{
|
|
135
148
|
flag: '--api-prefix <value>',
|
|
136
149
|
description: 'Prefix for API routes on any service that is started',
|
|
@@ -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 injectCompileCommand(program: Command, log: LogFn): Command;
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGlsZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL2NvbXBpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFHbkQsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBdUp6Qyx3QkFBZ0Isb0JBQW9CLENBQUMsT0FBTyxFQUFFLE9BQU8sRUFBRSxHQUFHLEVBQUUsS0FBSyxHQUFHLE9BQU8sQ0FzQjFFIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/compile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/compile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuJzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAsB1E"}
|
package/dest/cli/cmds/compile.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { findBbBinary } from '@aztec/bb.js';
|
|
2
2
|
import { execFileSync } from 'child_process';
|
|
3
|
-
import { readFile
|
|
3
|
+
import { readFile } from 'fs/promises';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
import { readArtifactFiles } from './utils/artifacts.js';
|
|
6
6
|
import { needsRecompile } from './utils/needs_recompile.js';
|
|
7
7
|
import { run } from './utils/spawn.js';
|
|
8
|
+
import { warnIfAztecVersionMismatch } from './utils/warn_if_aztec_version_mismatch.js';
|
|
8
9
|
/** Returns paths to contract artifacts in the target directory. */ async function collectContractArtifacts() {
|
|
9
10
|
let files;
|
|
10
11
|
try {
|
|
@@ -17,17 +18,6 @@ import { run } from './utils/spawn.js';
|
|
|
17
18
|
}
|
|
18
19
|
return files.filter((f)=>Array.isArray(f.content.functions)).map((f)=>f.filePath);
|
|
19
20
|
}
|
|
20
|
-
/** Strips the `__aztec_nr_internals__` prefix from function names in contract artifacts. */ async function stripInternalPrefixes(artifactPaths) {
|
|
21
|
-
for (const path of artifactPaths){
|
|
22
|
-
const artifact = JSON.parse(await readFile(path, 'utf-8'));
|
|
23
|
-
for (const fn of artifact.functions){
|
|
24
|
-
if (typeof fn.name === 'string') {
|
|
25
|
-
fn.name = fn.name.replace(/^__aztec_nr_internals__/, '');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
await writeFile(path, JSON.stringify(artifact, null, 2) + '\n');
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
21
|
/** Returns the set of package names that are contract crates in the current workspace. */ async function getContractPackageNames() {
|
|
32
22
|
const contractNames = new Set();
|
|
33
23
|
let rootToml;
|
|
@@ -118,6 +108,7 @@ import { run } from './utils/spawn.js';
|
|
|
118
108
|
}
|
|
119
109
|
}
|
|
120
110
|
/** Compiles Aztec Noir contracts and postprocesses artifacts. */ async function compileAztecContract(nargoArgs, log) {
|
|
111
|
+
await warnIfAztecVersionMismatch(log);
|
|
121
112
|
if (!await needsRecompile()) {
|
|
122
113
|
log('No source changes detected, skipping compilation.');
|
|
123
114
|
return;
|
|
@@ -141,8 +132,6 @@ import { run } from './utils/spawn.js';
|
|
|
141
132
|
'aztec_process',
|
|
142
133
|
...bbArgs
|
|
143
134
|
]);
|
|
144
|
-
// TODO: This should be part of bb aztec_process!
|
|
145
|
-
await stripInternalPrefixes(artifacts);
|
|
146
135
|
}
|
|
147
136
|
log('Compilation complete!');
|
|
148
137
|
}
|
|
@@ -9,7 +9,7 @@ import type { LogFn } from '@aztec/foundation/log';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function computeExpectedGenesisRoot(config: GenesisStateConfig, userLog: LogFn): Promise<{
|
|
11
11
|
genesisArchiveRoot: Fr;
|
|
12
|
-
|
|
12
|
+
genesis: import("@aztec/stdlib/world-state").GenesisData;
|
|
13
13
|
}>;
|
|
14
14
|
/**
|
|
15
15
|
* Waits until the canonical rollup's genesis archive root, VK tree root, and protocol contracts hash
|
package/dest/cli/cmds/standby.js
CHANGED
|
@@ -20,11 +20,11 @@ const ROLLUP_POLL_INTERVAL_S = 60;
|
|
|
20
20
|
const prefundAddresses = (config.prefundAddresses ?? []).map((a)=>AztecAddress.fromString(a));
|
|
21
21
|
const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts).concat(prefundAddresses);
|
|
22
22
|
userLog(`Initial funded accounts: ${initialFundedAccounts.map((a)=>a.toString()).join(', ')}`);
|
|
23
|
-
const { genesisArchiveRoot,
|
|
23
|
+
const { genesisArchiveRoot, genesis } = await getGenesisValues(initialFundedAccounts);
|
|
24
24
|
userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
|
|
25
25
|
return {
|
|
26
26
|
genesisArchiveRoot,
|
|
27
|
-
|
|
27
|
+
genesis
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
async function checkRollupCompatibility(rollup, expected) {
|
|
@@ -6,4 +6,4 @@ export type { ArchiverConfig, DataStoreConfig };
|
|
|
6
6
|
export declare function startArchiver(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers): Promise<{
|
|
7
7
|
config: ArchiverConfig & DataStoreConfig;
|
|
8
8
|
}>;
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfYXJjaGl2ZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvY21kcy9zdGFydF9hcmNoaXZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQW9FLE1BQU0saUJBQWlCLENBQUM7QUFJeEgsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUUvRSxPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQXNCLE1BQU0sd0JBQXdCLENBQUM7QUFLbEYsWUFBWSxFQUFFLGNBQWMsRUFBRSxlQUFlLEVBQUUsQ0FBQztBQUVoRCxvQ0FBb0M7QUFDcEMsd0JBQXNCLGFBQWEsQ0FDakMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsR0FDOUIsT0FBTyxDQUFDO0lBQUUsTUFBTSxFQUFFLGNBQWMsR0FBRyxlQUFlLENBQUE7Q0FBRSxDQUFDLENBcUN2RCJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_archiver.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAoE,MAAM,iBAAiB,CAAC;AAIxH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAKlF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAEhD,oCAAoC;AACpC,wBAAsB,aAAa,CACjC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,GAAG,eAAe,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"start_archiver.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAoE,MAAM,iBAAiB,CAAC;AAIxH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAKlF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAEhD,oCAAoC;AACpC,wBAAsB,aAAa,CACjC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,GAAG,eAAe,CAAA;CAAE,CAAC,CAqCvD"}
|
|
@@ -9,8 +9,10 @@ import { extractRelevantOptions } from '../util.js';
|
|
|
9
9
|
/** Starts a standalone archiver. */ export async function startArchiver(options, signalHandlers, services) {
|
|
10
10
|
const envConfig = getArchiverConfigFromEnv();
|
|
11
11
|
const cliOptions = extractRelevantOptions(options, {
|
|
12
|
-
|
|
12
|
+
// dataConfigMappings must come first: its l1Contracts only maps rollupAddress,
|
|
13
|
+
// while archiverConfigMappings (spread later) maps all L1 contract addresses.
|
|
13
14
|
...dataConfigMappings,
|
|
15
|
+
...archiverConfigMappings,
|
|
14
16
|
...blobClientConfigMapping
|
|
15
17
|
}, 'archiver');
|
|
16
18
|
let archiverConfig = {
|
|
@@ -5,4 +5,4 @@ import type { LogFn } from '@aztec/foundation/log';
|
|
|
5
5
|
export declare function startNode(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, adminServices: NamespacedApiHandlers, userLog: LogFn, networkName: NetworkNames): Promise<{
|
|
6
6
|
config: AztecNodeConfig;
|
|
7
7
|
}>;
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfbm9kZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3N0YXJ0X25vZGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUE2QyxNQUFNLG1CQUFtQixDQUFDO0FBS3BHLE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBZSxNQUFNLDBCQUEwQixDQUFDO0FBQzFFLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFFL0UsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUE4Qm5ELHdCQUFzQixTQUFTLENBQzdCLE9BQU8sRUFBRSxHQUFHLEVBQ1osY0FBYyxFQUFFLENBQUMsTUFBTSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsRUFBRSxFQUN2QyxRQUFRLEVBQUUscUJBQXFCLEVBQy9CLGFBQWEsRUFBRSxxQkFBcUIsRUFDcEMsT0FBTyxFQUFFLEtBQUssRUFDZCxXQUFXLEVBQUUsWUFBWSxHQUN4QixPQUFPLENBQUM7SUFBRSxNQUFNLEVBQUUsZUFBZSxDQUFBO0NBQUUsQ0FBQyxDQThKdEMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAA6C,MAAM,mBAAmB,CAAC;AAKpG,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"start_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAA6C,MAAM,mBAAmB,CAAC;AAKpG,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AA8BnD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,aAAa,EAAE,qBAAqB,EACpC,OAAO,EAAE,KAAK,EACd,WAAW,EAAE,YAAY,GACxB,OAAO,CAAC;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CA8JtC"}
|
|
@@ -7,7 +7,7 @@ import { SecretValue } from '@aztec/foundation/config';
|
|
|
7
7
|
import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
|
|
8
8
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
9
9
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
10
|
-
import { ProvingJobConsumerSchema, createProvingJobBrokerClient } from '@aztec/prover-client/broker';
|
|
10
|
+
import { ProvingJobConsumerSchema, createProvingJobBrokerClient, proverBrokerBackoff } from '@aztec/prover-client/broker';
|
|
11
11
|
import { allPxeConfigMappings } from '@aztec/pxe/config';
|
|
12
12
|
import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
13
13
|
import { P2PApiSchema, ProverNodeApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
@@ -39,20 +39,8 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
39
39
|
if (nodeConfig.proverBrokerUrl) {
|
|
40
40
|
// at 1TPS we'd enqueue ~1k chonk verifier proofs and ~1k AVM proofs immediately
|
|
41
41
|
// set a lower connection limit such that we don't overload the server
|
|
42
|
-
//
|
|
43
|
-
const fetch = makeTracedFetch(
|
|
44
|
-
1,
|
|
45
|
-
2,
|
|
46
|
-
3,
|
|
47
|
-
3,
|
|
48
|
-
3,
|
|
49
|
-
3,
|
|
50
|
-
3,
|
|
51
|
-
3,
|
|
52
|
-
3,
|
|
53
|
-
3,
|
|
54
|
-
3
|
|
55
|
-
], false, makeUndiciFetch(new Agent({
|
|
42
|
+
// Retry indefinitely until the epoch proving times out and the chain reorgs
|
|
43
|
+
const fetch = makeTracedFetch(proverBrokerBackoff, false, makeUndiciFetch(new Agent({
|
|
56
44
|
connections: 100
|
|
57
45
|
})));
|
|
58
46
|
broker = createProvingJobBrokerClient(nodeConfig.proverBrokerUrl, getVersions(nodeConfig), fetch);
|
|
@@ -65,7 +53,7 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
65
53
|
}
|
|
66
54
|
await preloadCrsDataForVerifying(nodeConfig, userLog);
|
|
67
55
|
const genesisConfig = getGenesisStateConfigEnvVars();
|
|
68
|
-
const { genesisArchiveRoot,
|
|
56
|
+
const { genesisArchiveRoot, genesis } = await computeExpectedGenesisRoot(genesisConfig, userLog);
|
|
69
57
|
const followsCanonicalRollup = typeof nodeConfig.rollupVersion !== 'number' || nodeConfig.rollupVersion === 'canonical';
|
|
70
58
|
if (!nodeConfig.l1Contracts.registryAddress || nodeConfig.l1Contracts.registryAddress.isZero()) {
|
|
71
59
|
throw new Error('L1 registry address is required to start Aztec Node');
|
|
@@ -82,12 +70,10 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
82
70
|
if (!Fr.fromHexString(config.genesisArchiveTreeRoot).equals(genesisArchiveRoot)) {
|
|
83
71
|
throw new Error(`The computed genesis archive tree root ${genesisArchiveRoot} does not match the expected genesis archive tree root ${config.genesisArchiveTreeRoot} for the rollup deployed at ${addresses.rollupAddress}`);
|
|
84
72
|
}
|
|
85
|
-
// TODO(#12272): will clean this up.
|
|
86
73
|
nodeConfig = {
|
|
87
74
|
...nodeConfig,
|
|
88
75
|
l1Contracts: {
|
|
89
|
-
...addresses
|
|
90
|
-
slashFactoryAddress: nodeConfig.l1Contracts.slashFactoryAddress
|
|
76
|
+
...addresses
|
|
91
77
|
},
|
|
92
78
|
...config
|
|
93
79
|
};
|
|
@@ -121,7 +107,7 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
121
107
|
telemetry,
|
|
122
108
|
proverBroker: broker
|
|
123
109
|
}, {
|
|
124
|
-
|
|
110
|
+
genesis
|
|
125
111
|
});
|
|
126
112
|
// Add node and p2p to services list
|
|
127
113
|
services.node = [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
3
|
export declare function startProverAgent(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, userLog: LogFn): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfcHJvdmVyX2FnZW50LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2NtZHMvc3RhcnRfcHJvdmVyX2FnZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFFL0UsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFpQm5ELHdCQUFzQixnQkFBZ0IsQ0FDcEMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsRUFDL0IsT0FBTyxFQUFFLEtBQUssaUJBb0RmIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_prover_agent.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"start_prover_agent.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAiBnD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,iBAoDf"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { times } from '@aztec/foundation/collection';
|
|
2
2
|
import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
|
|
3
3
|
import { buildServerCircuitProver } from '@aztec/prover-client';
|
|
4
|
-
import { ProvingAgent, createProofStore, createProvingJobBrokerClient, proverAgentConfigMappings } from '@aztec/prover-client/broker';
|
|
4
|
+
import { ProvingAgent, createProofStore, createProvingJobBrokerClient, proverAgentConfigMappings, proverBrokerBackoff } from '@aztec/prover-client/broker';
|
|
5
5
|
import { getProverNodeAgentConfigFromEnv } from '@aztec/prover-node';
|
|
6
6
|
import { ProverAgentApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
7
7
|
import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } from '@aztec/telemetry-client';
|
|
@@ -25,20 +25,8 @@ export async function startProverAgent(options, signalHandlers, services, userLo
|
|
|
25
25
|
process.exit(1);
|
|
26
26
|
}
|
|
27
27
|
await preloadCrsDataForServerSideProving(config, userLog);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
1,
|
|
31
|
-
2,
|
|
32
|
-
3,
|
|
33
|
-
3,
|
|
34
|
-
3,
|
|
35
|
-
3,
|
|
36
|
-
3,
|
|
37
|
-
3,
|
|
38
|
-
3,
|
|
39
|
-
3,
|
|
40
|
-
3
|
|
41
|
-
], false, makeUndiciFetch(new Agent({
|
|
28
|
+
// Retry indefinitely until the epoch proving times out and the chain reorgs
|
|
29
|
+
const fetch = makeTracedFetch(proverBrokerBackoff, false, makeUndiciFetch(new Agent({
|
|
42
30
|
connections: 10
|
|
43
31
|
})));
|
|
44
32
|
const broker = createProvingJobBrokerClient(config.proverBrokerUrl, getVersions(), fetch);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively collects crate directories starting from startCrateDir by following dependencies declared in Nargo.toml
|
|
3
|
+
* files.
|
|
4
|
+
*
|
|
5
|
+
* When `skipGitDeps` is false (default), git-based deps are followed and fetched into the nargo cache
|
|
6
|
+
* (`$HOME/nargo/<domain>/<repo-path>/<tag>`) if not already present.
|
|
7
|
+
*
|
|
8
|
+
* When `skipGitDeps` is true, git-based deps are ignored entirely.
|
|
9
|
+
*/
|
|
10
|
+
export declare function collectCrateDirs(startCrateDir: string, opts?: {
|
|
11
|
+
skipGitDeps?: boolean;
|
|
12
|
+
}): Promise<string[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Computes the local nargo cache path for a git dependency, mirroring nargo's own `git_dep_location` function.
|
|
15
|
+
* Path format: `$HOME/nargo/<domain>/<repo-path>/<tag>`
|
|
16
|
+
* e.g. `~/nargo/github.com/AztecProtocol/aztec-packages/v0.82.0`
|
|
17
|
+
*
|
|
18
|
+
* Source: noir/noir-repo/tooling/nargo_toml/src/git.rs
|
|
19
|
+
*/
|
|
20
|
+
export declare function nargoGitDepPath(gitUrl: string, tag: string): string;
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sbGVjdF9jcmF0ZV9kaXJzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvY29sbGVjdF9jcmF0ZV9kaXJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVFBOzs7Ozs7OztHQVFHO0FBQ0gsd0JBQXNCLGdCQUFnQixDQUFDLGFBQWEsRUFBRSxNQUFNLEVBQUUsSUFBSSxDQUFDLEVBQUU7SUFBRSxXQUFXLENBQUMsRUFBRSxPQUFPLENBQUE7Q0FBRSxHQUFHLE9BQU8sQ0FBQyxNQUFNLEVBQUUsQ0FBQyxDQWlFakg7QUFFRDs7Ozs7O0dBTUc7QUFDSCx3QkFBZ0IsZUFBZSxDQUFDLE1BQU0sRUFBRSxNQUFNLEVBQUUsR0FBRyxFQUFFLE1BQU0sR0FBRyxNQUFNLENBS25FIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect_crate_dirs.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/collect_crate_dirs.ts"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAiEjH;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKnE"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import TOML from '@iarna/toml';
|
|
2
|
+
import { existsSync } from 'fs';
|
|
3
|
+
import { mkdir, readFile, stat } from 'fs/promises';
|
|
4
|
+
import { homedir } from 'os';
|
|
5
|
+
import { dirname, join, resolve } from 'path';
|
|
6
|
+
import { run } from './spawn.js';
|
|
7
|
+
/**
|
|
8
|
+
* Recursively collects crate directories starting from startCrateDir by following dependencies declared in Nargo.toml
|
|
9
|
+
* files.
|
|
10
|
+
*
|
|
11
|
+
* When `skipGitDeps` is false (default), git-based deps are followed and fetched into the nargo cache
|
|
12
|
+
* (`$HOME/nargo/<domain>/<repo-path>/<tag>`) if not already present.
|
|
13
|
+
*
|
|
14
|
+
* When `skipGitDeps` is true, git-based deps are ignored entirely.
|
|
15
|
+
*/ export async function collectCrateDirs(startCrateDir, opts) {
|
|
16
|
+
const { skipGitDeps = false } = opts ?? {};
|
|
17
|
+
const visited = new Set();
|
|
18
|
+
async function visit(crateDir) {
|
|
19
|
+
const absDir = resolve(crateDir);
|
|
20
|
+
if (visited.has(absDir)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
visited.add(absDir);
|
|
24
|
+
const tomlPath = join(absDir, 'Nargo.toml');
|
|
25
|
+
const content = await readFile(tomlPath, 'utf-8').catch(()=>{
|
|
26
|
+
throw new Error(`Incorrectly defined dependency. Nargo.toml not found in ${absDir}`);
|
|
27
|
+
});
|
|
28
|
+
const parsed = TOML.parse(content);
|
|
29
|
+
const members = parsed.workspace?.members;
|
|
30
|
+
// A Nargo.toml is either a workspace root (has workspace.members) or a single crate (has dependencies).
|
|
31
|
+
if (Array.isArray(members)) {
|
|
32
|
+
// The crate is a workspace root and has members defined so we visit the members
|
|
33
|
+
for (const member of members){
|
|
34
|
+
await visit(resolve(absDir, member));
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
// Single crate — follow its deps
|
|
38
|
+
const deps = parsed.dependencies ?? {};
|
|
39
|
+
for (const dep of Object.values(deps)){
|
|
40
|
+
if (!dep || typeof dep !== 'object') {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (typeof dep.path === 'string') {
|
|
44
|
+
// Dependency contains "path" hence it's a local dependency. We just check it's a real directory and then we
|
|
45
|
+
// recursively search through it
|
|
46
|
+
const depPath = resolve(absDir, dep.path);
|
|
47
|
+
const s = await stat(depPath);
|
|
48
|
+
if (!s.isDirectory()) {
|
|
49
|
+
throw new Error(`Dependency path "${dep.path}" in ${tomlPath} resolves to ${depPath} which is not a directory`);
|
|
50
|
+
}
|
|
51
|
+
await visit(depPath);
|
|
52
|
+
} else if (!skipGitDeps && typeof dep.git === 'string' && typeof dep.tag === 'string') {
|
|
53
|
+
// Dependency contains "git" hence it's a git dependency. We ensure it has been fetched and fetch it if
|
|
54
|
+
// it's not the case and then we recursively search through it.
|
|
55
|
+
await fetchAndVisit(dep.git, dep.tag, dep.directory);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function fetchAndVisit(gitUrl, tag, directory) {
|
|
61
|
+
// `directory` is set when the dep lives in a subdirectory of a repository, e.g.:
|
|
62
|
+
// aztec = { git = "https://github.com/AztecProtocol/aztec-packages", tag = "v0.82.0",
|
|
63
|
+
// directory = "noir-projects/aztec-nr/aztec" }
|
|
64
|
+
// In that case nargo clones the whole repo and the crate root is <cachePath>/<directory>.
|
|
65
|
+
const cachePath = nargoGitDepPath(gitUrl, tag);
|
|
66
|
+
const crateDir = directory ? join(cachePath, directory) : cachePath;
|
|
67
|
+
await ensureGitDepCached(gitUrl, tag, cachePath);
|
|
68
|
+
await visit(crateDir);
|
|
69
|
+
}
|
|
70
|
+
await visit(startCrateDir);
|
|
71
|
+
return [
|
|
72
|
+
...visited
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Computes the local nargo cache path for a git dependency, mirroring nargo's own `git_dep_location` function.
|
|
77
|
+
* Path format: `$HOME/nargo/<domain>/<repo-path>/<tag>`
|
|
78
|
+
* e.g. `~/nargo/github.com/AztecProtocol/aztec-packages/v0.82.0`
|
|
79
|
+
*
|
|
80
|
+
* Source: noir/noir-repo/tooling/nargo_toml/src/git.rs
|
|
81
|
+
*/ export function nargoGitDepPath(gitUrl, tag) {
|
|
82
|
+
const url = new URL(gitUrl);
|
|
83
|
+
const domain = url.hostname;
|
|
84
|
+
const repoPath = url.pathname.replace(/^\//, '');
|
|
85
|
+
return join(process.env.HOME ?? homedir(), 'nargo', domain, repoPath, tag);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Ensures a git dep is present in the nargo cache, cloning it if it isn't. Mirrors nargo's `clone_git_repo`.
|
|
89
|
+
* If cloning fails (e.g. no network), throws with a message suggesting `nargo check` to prime the cache.
|
|
90
|
+
*
|
|
91
|
+
* Source: noir/noir-repo/tooling/nargo_toml/src/git.rs
|
|
92
|
+
*/ async function ensureGitDepCached(gitUrl, tag, cachePath) {
|
|
93
|
+
if (existsSync(cachePath)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
await mkdir(dirname(cachePath), {
|
|
97
|
+
recursive: true
|
|
98
|
+
});
|
|
99
|
+
try {
|
|
100
|
+
await run('git', [
|
|
101
|
+
'-c',
|
|
102
|
+
'advice.detachedHead=false',
|
|
103
|
+
'clone',
|
|
104
|
+
'--depth',
|
|
105
|
+
'1',
|
|
106
|
+
'--branch',
|
|
107
|
+
tag,
|
|
108
|
+
gitUrl,
|
|
109
|
+
cachePath
|
|
110
|
+
]);
|
|
111
|
+
} catch (err) {
|
|
112
|
+
throw new Error(`Failed to fetch git dependency ${gitUrl}@${tag}: ${err?.message ?? err}.\n` + `Try running \`nargo check\` first to prime the dependency cache.`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* Note: The above implies that if there is a random json file in the target dir we would be always recompiling.
|
|
8
8
|
*/
|
|
9
9
|
export declare function needsRecompile(): Promise<boolean>;
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmVlZHNfcmVjb21waWxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvbmVlZHNfcmVjb21waWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0IsY0FBYyxJQUFJLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FXdkQifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"needs_recompile.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/needs_recompile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"needs_recompile.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/needs_recompile.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAWvD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { readdir, stat } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { collectCrateDirs } from './collect_crate_dirs.js';
|
|
4
4
|
/**
|
|
5
5
|
* Returns true if recompilation is needed: either no artifacts exist in target/ or any .nr or Nargo.toml source file
|
|
6
6
|
* (including path-based dependencies) is newer than the oldest artifact. We compare against the oldest artifact so
|
|
@@ -13,7 +13,12 @@ import { join, resolve } from 'path';
|
|
|
13
13
|
if (oldestArtifactMs === undefined) {
|
|
14
14
|
return true;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
// Git deps are pinned to a specific tag in Nargo.toml and nargo always fetches an exact tag, so their contents never
|
|
17
|
+
// change without Nargo.toml itself changing — and Nargo.toml is already tracked as a source file. Hence we can
|
|
18
|
+
// safely ignore checking source files of git deps.
|
|
19
|
+
const crateDirs = await collectCrateDirs('.', {
|
|
20
|
+
skipGitDeps: true
|
|
21
|
+
});
|
|
17
22
|
return hasNewerSourceFile(crateDirs, oldestArtifactMs);
|
|
18
23
|
}
|
|
19
24
|
/**
|
|
@@ -41,55 +46,6 @@ import { join, resolve } from 'path';
|
|
|
41
46
|
}
|
|
42
47
|
return oldest;
|
|
43
48
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Recursively collects crate directories starting from startCrateDir by following path-based dependencies declared in
|
|
46
|
-
* Nargo.toml files. Git-based deps are ignored (they only change when Nargo.toml itself is modified since the deps are
|
|
47
|
-
* tagged).
|
|
48
|
-
*/ async function collectCrateDirs(startCrateDir) {
|
|
49
|
-
// We have a set of visited dirs we check against when entering a new dir because we could stumble upon a directory
|
|
50
|
-
// multiple times in case multiple deps shared a dep (e.g. dep A and dep B both sharing dep C).
|
|
51
|
-
const visited = new Set();
|
|
52
|
-
async function visit(crateDir) {
|
|
53
|
-
const absDir = resolve(crateDir);
|
|
54
|
-
if (visited.has(absDir)) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
visited.add(absDir);
|
|
58
|
-
// Every dep is its own crate and every crate needs to have Nargo.toml defined in the root so we try to load it and
|
|
59
|
-
// error out if it's not the case.
|
|
60
|
-
const tomlPath = join(absDir, 'Nargo.toml');
|
|
61
|
-
const content = await readFile(tomlPath, 'utf-8').catch(()=>{
|
|
62
|
-
throw new Error(`Incorrectly defined dependency. Nargo.toml not found in ${absDir}`);
|
|
63
|
-
});
|
|
64
|
-
const parsed = TOML.parse(content);
|
|
65
|
-
const members = parsed.workspace?.members;
|
|
66
|
-
// A Nargo.toml is either a workspace root (has workspace.members) or a single crate (has dependencies).
|
|
67
|
-
if (Array.isArray(members)) {
|
|
68
|
-
// The crate is a workspace root and has members defined so we visit the members
|
|
69
|
-
for (const member of members){
|
|
70
|
-
const memberPath = resolve(absDir, member);
|
|
71
|
-
await visit(memberPath);
|
|
72
|
-
}
|
|
73
|
-
} else {
|
|
74
|
-
// The crate is not a workspace root so we check for dependencies
|
|
75
|
-
const deps = parsed.dependencies ?? {};
|
|
76
|
-
for (const dep of Object.values(deps)){
|
|
77
|
-
if (dep && typeof dep === 'object' && typeof dep.path === 'string') {
|
|
78
|
-
const depPath = resolve(absDir, dep.path);
|
|
79
|
-
const s = await stat(depPath);
|
|
80
|
-
if (!s.isDirectory()) {
|
|
81
|
-
throw new Error(`Dependency path "${dep.path}" in ${tomlPath} resolves to ${depPath} which is not a directory`);
|
|
82
|
-
}
|
|
83
|
-
await visit(depPath);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
await visit(startCrateDir);
|
|
89
|
-
return [
|
|
90
|
-
...visited
|
|
91
|
-
];
|
|
92
|
-
}
|
|
93
49
|
/**
|
|
94
50
|
* Walks crate dirs looking for .nr and Nargo.toml files newer than thresholdMs. Short-circuits on the first match.
|
|
95
51
|
*/ async function hasNewerSourceFile(crateDirs, thresholdMs) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
+
/** Warns if any aztec-nr git dependency in a crate's Nargo.toml has a tag that doesn't match the CLI version. */
|
|
3
|
+
export declare function warnIfAztecVersionMismatch(log: LogFn, cliVersion?: string): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2Fybl9pZl9henRlY192ZXJzaW9uX21pc21hdGNoLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvd2Fybl9pZl9henRlY192ZXJzaW9uX21pc21hdGNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBMkJuRCxpSEFBaUg7QUFDakgsd0JBQXNCLDBCQUEwQixDQUFDLEdBQUcsRUFBRSxLQUFLLEVBQUUsVUFBVSxDQUFDLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FnRC9GIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warn_if_aztec_version_mismatch.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AA2BnD,iHAAiH;AACjH,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgD/F"}
|