@aztec-labs/aztec 6.0.0-nightly.20260829
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/README.md +57 -0
- package/dest/bin/index.d.ts +3 -0
- package/dest/bin/index.d.ts.map +1 -0
- package/dest/bin/index.js +61 -0
- package/dest/cli/admin_api_key_store.d.ts +45 -0
- package/dest/cli/admin_api_key_store.d.ts.map +1 -0
- package/dest/cli/admin_api_key_store.js +98 -0
- package/dest/cli/aztec_start_action.d.ts +3 -0
- package/dest/cli/aztec_start_action.d.ts.map +1 -0
- package/dest/cli/aztec_start_action.js +153 -0
- package/dest/cli/aztec_start_options.d.ts +17 -0
- package/dest/cli/aztec_start_options.d.ts.map +1 -0
- package/dest/cli/aztec_start_options.js +290 -0
- package/dest/cli/cli.d.ts +9 -0
- package/dest/cli/cli.d.ts.map +1 -0
- package/dest/cli/cli.js +37 -0
- 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 +174 -0
- package/dest/cli/cmds/migrate_ha_db.d.ts +3 -0
- package/dest/cli/cmds/migrate_ha_db.d.ts.map +1 -0
- package/dest/cli/cmds/migrate_ha_db.js +27 -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 +52 -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 +76 -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/prover.d.ts +4 -0
- package/dest/cli/cmds/prover.d.ts.map +1 -0
- package/dest/cli/cmds/prover.js +24 -0
- package/dest/cli/cmds/standby.d.ts +56 -0
- package/dest/cli/cmds/standby.d.ts.map +1 -0
- package/dest/cli/cmds/standby.js +140 -0
- package/dest/cli/cmds/start_bot.d.ts +8 -0
- package/dest/cli/cmds/start_bot.d.ts.map +1 -0
- package/dest/cli/cmds/start_bot.js +53 -0
- package/dest/cli/cmds/start_node.d.ts +8 -0
- package/dest/cli/cmds/start_node.d.ts.map +1 -0
- package/dest/cli/cmds/start_node.js +150 -0
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts +6 -0
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts.map +1 -0
- package/dest/cli/cmds/start_p2p_bootstrap.js +30 -0
- package/dest/cli/cmds/start_prover_agent.d.ts +4 -0
- package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -0
- package/dest/cli/cmds/start_prover_agent.js +58 -0
- package/dest/cli/cmds/start_prover_broker.d.ts +9 -0
- package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -0
- package/dest/cli/cmds/start_prover_broker.js +46 -0
- package/dest/cli/cmds/start_txe.d.ts +3 -0
- package/dest/cli/cmds/start_txe.d.ts.map +1 -0
- package/dest/cli/cmds/start_txe.js +12 -0
- package/dest/cli/cmds/utils/artifacts.d.ts +26 -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/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 +10 -0
- package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -0
- package/dest/cli/cmds/utils/needs_recompile.js +90 -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/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 +61 -0
- package/dest/cli/index.d.ts +2 -0
- package/dest/cli/index.d.ts.map +1 -0
- package/dest/cli/index.js +1 -0
- package/dest/cli/preload_crs.d.ts +3 -0
- package/dest/cli/preload_crs.d.ts.map +1 -0
- package/dest/cli/preload_crs.js +6 -0
- package/dest/cli/util.d.ts +71 -0
- package/dest/cli/util.d.ts.map +1 -0
- package/dest/cli/util.js +261 -0
- package/dest/cli/versioning.d.ts +4 -0
- package/dest/cli/versioning.d.ts.map +1 -0
- package/dest/cli/versioning.js +9 -0
- package/dest/examples/token.d.ts +2 -0
- package/dest/examples/token.d.ts.map +1 -0
- package/dest/examples/token.js +59 -0
- package/dest/examples/util.d.ts +19 -0
- package/dest/examples/util.d.ts.map +1 -0
- package/dest/examples/util.js +30 -0
- package/dest/index.d.ts +2 -0
- package/dest/index.d.ts.map +1 -0
- package/dest/index.js +1 -0
- package/dest/local-network/auth_registry.d.ts +5 -0
- package/dest/local-network/auth_registry.d.ts.map +1 -0
- package/dest/local-network/auth_registry.js +17 -0
- package/dest/local-network/banana_fpc.d.ts +11 -0
- package/dest/local-network/banana_fpc.d.ts.map +1 -0
- package/dest/local-network/banana_fpc.js +81 -0
- package/dest/local-network/index.d.ts +4 -0
- package/dest/local-network/index.d.ts.map +1 -0
- package/dest/local-network/index.js +3 -0
- package/dest/local-network/local-network.d.ts +51 -0
- package/dest/local-network/local-network.d.ts.map +1 -0
- package/dest/local-network/local-network.js +205 -0
- package/dest/local-network/sponsored_fpc.d.ts +5 -0
- package/dest/local-network/sponsored_fpc.d.ts.map +1 -0
- package/dest/local-network/sponsored_fpc.js +18 -0
- package/dest/mnemonic.d.ts +2 -0
- package/dest/mnemonic.d.ts.map +1 -0
- package/dest/mnemonic.js +1 -0
- package/dest/splash.d.ts +3 -0
- package/dest/splash.d.ts.map +1 -0
- package/dest/splash.js +2 -0
- package/dest/testing/cheat_codes.d.ts +37 -0
- package/dest/testing/cheat_codes.d.ts.map +1 -0
- package/dest/testing/cheat_codes.js +36 -0
- package/dest/testing/epoch_test_settler.d.ts +19 -0
- package/dest/testing/epoch_test_settler.d.ts.map +1 -0
- package/dest/testing/epoch_test_settler.js +42 -0
- package/dest/testing/index.d.ts +6 -0
- package/dest/testing/index.d.ts.map +1 -0
- package/dest/testing/index.js +5 -0
- package/dest/testing/local-network.d.ts +51 -0
- package/dest/testing/local-network.d.ts.map +1 -0
- package/dest/testing/local-network.js +60 -0
- package/dest/testing/token_allowed_setup.d.ts +12 -0
- package/dest/testing/token_allowed_setup.d.ts.map +1 -0
- package/dest/testing/token_allowed_setup.js +24 -0
- package/package.json +125 -0
- package/scripts/add_crate.sh +53 -0
- package/scripts/aztec.sh +73 -0
- package/scripts/init.sh +39 -0
- package/scripts/new.sh +83 -0
- package/scripts/setup_workspace.sh +69 -0
- 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/bin/index.ts +73 -0
- package/src/cli/admin_api_key_store.ts +127 -0
- package/src/cli/aztec_start_action.ts +173 -0
- package/src/cli/aztec_start_options.ts +333 -0
- package/src/cli/cli.ts +55 -0
- package/src/cli/cmds/compile.ts +205 -0
- package/src/cli/cmds/migrate_ha_db.ts +42 -0
- package/src/cli/cmds/profile.ts +25 -0
- package/src/cli/cmds/profile_flamegraph.ts +64 -0
- package/src/cli/cmds/profile_gates.ts +84 -0
- package/src/cli/cmds/profile_utils.ts +58 -0
- package/src/cli/cmds/prover.ts +41 -0
- package/src/cli/cmds/standby.ts +183 -0
- package/src/cli/cmds/start_bot.ts +78 -0
- package/src/cli/cmds/start_node.ts +199 -0
- package/src/cli/cmds/start_p2p_bootstrap.ts +37 -0
- package/src/cli/cmds/start_prover_agent.ts +77 -0
- package/src/cli/cmds/start_prover_broker.ts +69 -0
- package/src/cli/cmds/start_txe.ts +17 -0
- package/src/cli/cmds/utils/artifacts.ts +49 -0
- package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
- package/src/cli/cmds/utils/needs_recompile.ts +98 -0
- package/src/cli/cmds/utils/spawn.ts +16 -0
- package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +75 -0
- package/src/cli/index.ts +1 -0
- package/src/cli/preload_crs.ts +7 -0
- package/src/cli/util.ts +310 -0
- package/src/cli/versioning.ts +13 -0
- package/src/examples/token.ts +77 -0
- package/src/examples/util.ts +42 -0
- package/src/index.ts +6 -0
- package/src/local-network/auth_registry.ts +19 -0
- package/src/local-network/banana_fpc.ts +89 -0
- package/src/local-network/index.ts +7 -0
- package/src/local-network/local-network.ts +254 -0
- package/src/local-network/sponsored_fpc.ts +26 -0
- package/src/mnemonic.ts +1 -0
- package/src/splash.ts +10 -0
- package/src/testing/cheat_codes.ts +48 -0
- package/src/testing/epoch_test_settler.ts +47 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/local-network.ts +96 -0
- package/src/testing/token_allowed_setup.ts +26 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsonStringify } from '@aztec-labs/foundation/json-rpc';
|
|
2
|
+
import { createStore } from '@aztec-labs/kv-store/lmdb-v2';
|
|
3
|
+
import { BootstrapNode, bootnodeConfigMappings } from '@aztec-labs/p2p';
|
|
4
|
+
import { emptyChainConfig } from '@aztec-labs/stdlib/config';
|
|
5
|
+
import { P2PBootstrapApiSchema } from '@aztec-labs/stdlib/interfaces/server';
|
|
6
|
+
import { initTelemetryClient, telemetryClientConfigMappings } from '@aztec-labs/telemetry-client';
|
|
7
|
+
import { extractRelevantOptions } from '../util.js';
|
|
8
|
+
export async function startP2PBootstrap(options, signalHandlers, services, userLog) {
|
|
9
|
+
// Start a P2P bootstrap node.
|
|
10
|
+
const config = extractRelevantOptions(options, bootnodeConfigMappings, 'p2p');
|
|
11
|
+
const safeConfig = {
|
|
12
|
+
...config,
|
|
13
|
+
peerIdPrivateKey: '<redacted>'
|
|
14
|
+
};
|
|
15
|
+
userLog(`Starting P2P bootstrap node with config: ${jsonStringify(safeConfig)}`);
|
|
16
|
+
const telemetryConfig = extractRelevantOptions(options, telemetryClientConfigMappings, 'tel');
|
|
17
|
+
const telemetryClient = await initTelemetryClient(telemetryConfig);
|
|
18
|
+
const store = await createStore('p2p-bootstrap', 1, config);
|
|
19
|
+
const node = new BootstrapNode(store, telemetryClient);
|
|
20
|
+
await node.start(config);
|
|
21
|
+
signalHandlers.push(()=>node.stop());
|
|
22
|
+
services.bootstrap = [
|
|
23
|
+
node,
|
|
24
|
+
P2PBootstrapApiSchema
|
|
25
|
+
];
|
|
26
|
+
userLog(`P2P bootstrap node started on ${config.p2pIp}:${config.p2pPort}`);
|
|
27
|
+
return {
|
|
28
|
+
config: emptyChainConfig
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NamespacedApiHandlers } from '@aztec-labs/foundation/json-rpc/server';
|
|
2
|
+
import type { LogFn } from '@aztec-labs/foundation/log';
|
|
3
|
+
export declare function startProverAgent(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, userLog: LogFn): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfcHJvdmVyX2FnZW50LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2NtZHMvc3RhcnRfcHJvdmVyX2FnZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sd0NBQXdDLENBQUM7QUFFcEYsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFpQnhELHdCQUFzQixnQkFBZ0IsQ0FDcEMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsRUFDL0IsT0FBTyxFQUFFLEtBQUssaUJBb0RmIn0=
|
|
@@ -0,0 +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,wCAAwC,CAAC;AAEpF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAiBxD,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"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { times } from '@aztec-labs/foundation/collection';
|
|
2
|
+
import { Agent, makeUndiciFetch } from '@aztec-labs/foundation/json-rpc/undici';
|
|
3
|
+
import { buildServerCircuitProver } from '@aztec-labs/prover-client';
|
|
4
|
+
import { ProvingAgent, createProofStore, createProvingJobBrokerClient, proverAgentConfigMappings, proverBrokerBackoff } from '@aztec-labs/prover-client/broker';
|
|
5
|
+
import { getProverNodeAgentConfigFromEnv } from '@aztec-labs/prover-node';
|
|
6
|
+
import { ProverAgentApiSchema } from '@aztec-labs/stdlib/interfaces/server';
|
|
7
|
+
import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } from '@aztec-labs/telemetry-client';
|
|
8
|
+
import { extractRelevantOptions, preloadCrsDataForServerSideProving } from '../util.js';
|
|
9
|
+
import { getVersions } from '../versioning.js';
|
|
10
|
+
export async function startProverAgent(options, signalHandlers, services, userLog) {
|
|
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
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
const config = {
|
|
16
|
+
...getProverNodeAgentConfigFromEnv(),
|
|
17
|
+
...extractRelevantOptions(options, proverAgentConfigMappings, 'proverAgent')
|
|
18
|
+
};
|
|
19
|
+
if (config.realProofs && (!config.bbBinaryPath || !config.acvmBinaryPath)) {
|
|
20
|
+
userLog(`Requested real proving but no path to bb or acvm binaries provided`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
if (!config.proverBrokerUrl) {
|
|
24
|
+
userLog(`Missing prover broker URL. Pass --proverAgent.proverBrokerUrl <value>`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
await preloadCrsDataForServerSideProving(config, userLog);
|
|
28
|
+
// Retry indefinitely until the epoch proving times out and the chain reorgs
|
|
29
|
+
const fetch = makeTracedFetch(proverBrokerBackoff, false, makeUndiciFetch(new Agent({
|
|
30
|
+
connections: 10
|
|
31
|
+
})));
|
|
32
|
+
const broker = createProvingJobBrokerClient(config.proverBrokerUrl, getVersions(), fetch);
|
|
33
|
+
const telemetry = await initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
|
|
34
|
+
const prover = await buildServerCircuitProver(config, telemetry);
|
|
35
|
+
const proofStore = await createProofStore(config.proofStore);
|
|
36
|
+
const agents = times(config.proverAgentCount, ()=>new ProvingAgent(broker, proofStore, prover, config.proverAgentProofTypes, config.proverAgentPollIntervalMs));
|
|
37
|
+
// expose all agents as individual services
|
|
38
|
+
for(let i = 0; i < agents.length; i++){
|
|
39
|
+
services[`agent${i}`] = [
|
|
40
|
+
agents[i],
|
|
41
|
+
ProverAgentApiSchema,
|
|
42
|
+
()=>agents[i].getStatus().status !== 'stopped'
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
// shortcut in the most common case of having a single running agent
|
|
46
|
+
if (agents.length === 1) {
|
|
47
|
+
services[`agent`] = [
|
|
48
|
+
agents[0],
|
|
49
|
+
ProverAgentApiSchema,
|
|
50
|
+
()=>agents[0].getStatus().status !== 'stopped'
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
await Promise.all(agents.map((agent)=>agent.start()));
|
|
54
|
+
signalHandlers.push(async ()=>{
|
|
55
|
+
await Promise.all(agents.map((agent)=>agent.stop()));
|
|
56
|
+
await telemetry.stop();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NamespacedApiHandlers } from '@aztec-labs/foundation/json-rpc/server';
|
|
2
|
+
import type { LogFn } from '@aztec-labs/foundation/log';
|
|
3
|
+
import { type ProverBrokerConfig } from '@aztec-labs/prover-client/broker';
|
|
4
|
+
import type { ProvingJobBroker } from '@aztec-labs/stdlib/interfaces/server';
|
|
5
|
+
export declare function startProverBroker(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, userLog: LogFn): Promise<{
|
|
6
|
+
broker: ProvingJobBroker;
|
|
7
|
+
config: ProverBrokerConfig;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfcHJvdmVyX2Jyb2tlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3N0YXJ0X3Byb3Zlcl9icm9rZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSx3Q0FBd0MsQ0FBQztBQUNwRixPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUd4RCxPQUFPLEVBQ0wsS0FBSyxrQkFBa0IsRUFLeEIsTUFBTSxrQ0FBa0MsQ0FBQztBQUUxQyxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHNDQUFzQyxDQUFDO0FBTTdFLHdCQUFzQixpQkFBaUIsQ0FDckMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsRUFDL0IsT0FBTyxFQUFFLEtBQUssR0FDYixPQUFPLENBQUM7SUFBRSxNQUFNLEVBQUUsZ0JBQWdCLENBQUM7SUFBQyxNQUFNLEVBQUUsa0JBQWtCLENBQUE7Q0FBRSxDQUFDLENBMkNuRSJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start_prover_broker.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_broker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGxD,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAM7E,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC,CA2CnE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { getL1Config } from '@aztec-labs/cli/config';
|
|
2
|
+
import { getGenesisStateConfigEnvVars } from '@aztec-labs/ethereum/config';
|
|
3
|
+
import { getVKTreeRoot } from '@aztec-labs/noir-protocol-circuits-types/vk-tree';
|
|
4
|
+
import { protocolContractsHash } from '@aztec-labs/protocol-contracts';
|
|
5
|
+
import { ProvingJobBrokerSchema, ProvingJobBrokerSchemaWithDebug, createAndStartProvingBroker, proverBrokerConfigMappings } from '@aztec-labs/prover-client/broker';
|
|
6
|
+
import { getProverNodeBrokerConfigFromEnv } from '@aztec-labs/prover-node';
|
|
7
|
+
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec-labs/telemetry-client';
|
|
8
|
+
import { extractRelevantOptions } from '../util.js';
|
|
9
|
+
import { computeExpectedGenesisRoot, waitForCompatibleRollup } from './standby.js';
|
|
10
|
+
export async function startProverBroker(options, signalHandlers, services, userLog) {
|
|
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
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
const baseConfig = {
|
|
16
|
+
...getProverNodeBrokerConfigFromEnv(),
|
|
17
|
+
...extractRelevantOptions(options, proverBrokerConfigMappings, 'proverBroker')
|
|
18
|
+
};
|
|
19
|
+
if (!baseConfig.registryAddress || baseConfig.registryAddress.isZero()) {
|
|
20
|
+
throw new Error('L1 registry address is required to start Aztec Node without --deploy-aztec-contracts option');
|
|
21
|
+
}
|
|
22
|
+
const genesisConfig = getGenesisStateConfigEnvVars();
|
|
23
|
+
const { genesisArchiveRoot } = await computeExpectedGenesisRoot(genesisConfig, userLog);
|
|
24
|
+
await waitForCompatibleRollup(baseConfig, {
|
|
25
|
+
genesisArchiveRoot,
|
|
26
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
27
|
+
protocolContractsHash
|
|
28
|
+
}, options.port, userLog);
|
|
29
|
+
const { addresses, config: rollupConfig } = await getL1Config(baseConfig.registryAddress, baseConfig.l1RpcUrls, baseConfig.l1ChainId, baseConfig.rollupVersion);
|
|
30
|
+
const config = {
|
|
31
|
+
...baseConfig,
|
|
32
|
+
...addresses,
|
|
33
|
+
rollupVersion: rollupConfig.rollupVersion
|
|
34
|
+
};
|
|
35
|
+
const client = await initTelemetryClient(getTelemetryClientConfig());
|
|
36
|
+
const broker = await createAndStartProvingBroker(config, client);
|
|
37
|
+
services.proverBroker = [
|
|
38
|
+
broker,
|
|
39
|
+
config.proverBrokerDebugReplayEnabled ? ProvingJobBrokerSchemaWithDebug : ProvingJobBrokerSchema
|
|
40
|
+
];
|
|
41
|
+
signalHandlers.push(()=>broker.stop());
|
|
42
|
+
return {
|
|
43
|
+
broker,
|
|
44
|
+
config
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Logger } from '@aztec-labs/foundation/log';
|
|
2
|
+
export declare function startTXE(options: any, signalHandlers: Array<() => Promise<void>>, debugLogger: Logger): Promise<void>;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfdHhlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2NtZHMvc3RhcnRfdHhlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBR3pELHdCQUFzQixRQUFRLENBQUMsT0FBTyxFQUFFLEdBQUcsRUFBRSxjQUFjLEVBQUUsS0FBSyxDQUFDLE1BQU0sT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLEVBQUUsV0FBVyxFQUFFLE1BQU0saUJBWTNHIn0=
|
|
@@ -0,0 +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,4BAA4B,CAAC;AAGzD,wBAAsB,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,iBAY3G"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { startHttpRpcServer } from '@aztec-labs/foundation/json-rpc/server';
|
|
2
|
+
import { createTXERpcServer } from '@aztec-labs/txe/server';
|
|
3
|
+
export async function startTXE(options, signalHandlers, debugLogger) {
|
|
4
|
+
debugLogger.info(`Setting up TXE...`);
|
|
5
|
+
const txeServer = await createTXERpcServer(debugLogger);
|
|
6
|
+
const httpServer = await startHttpRpcServer(txeServer, {
|
|
7
|
+
port: options.port,
|
|
8
|
+
timeoutMs: 1e3 * 60 * 5
|
|
9
|
+
});
|
|
10
|
+
signalHandlers.push(()=>new Promise((resolve)=>httpServer.close(()=>resolve())));
|
|
11
|
+
debugLogger.info(`TXE listening on port ${httpServer.port}`);
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface CompiledArtifact {
|
|
2
|
+
noir_version: string;
|
|
3
|
+
file_map: unknown;
|
|
4
|
+
functions: ContractFunction[];
|
|
5
|
+
bytecode?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Set to true by the AVM transpiler (invoked via `bb aztec_process`) once the contract has been transpiled and its
|
|
8
|
+
* verification keys generated. Absent on raw `nargo compile` output, hence optional.
|
|
9
|
+
*/
|
|
10
|
+
transpiled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ContractFunction {
|
|
13
|
+
name: string;
|
|
14
|
+
abi: unknown;
|
|
15
|
+
bytecode: string;
|
|
16
|
+
debug_symbols: unknown;
|
|
17
|
+
is_unconstrained?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface ArtifactFile {
|
|
20
|
+
name: string;
|
|
21
|
+
filePath: string;
|
|
22
|
+
content: CompiledArtifact;
|
|
23
|
+
}
|
|
24
|
+
/** Reads all JSON artifact files from a target directory and returns their parsed contents. */
|
|
25
|
+
export declare function readArtifactFiles(targetDir: string): Promise<ArtifactFile[]>;
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJ0aWZhY3RzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvYXJ0aWZhY3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE1BQU0sV0FBVyxnQkFBZ0I7SUFDL0IsWUFBWSxFQUFFLE1BQU0sQ0FBQztJQUNyQixRQUFRLEVBQUUsT0FBTyxDQUFDO0lBQ2xCLFNBQVMsRUFBRSxnQkFBZ0IsRUFBRSxDQUFDO0lBQzlCLFFBQVEsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUNsQjs7O09BR0c7SUFDSCxVQUFVLENBQUMsRUFBRSxPQUFPLENBQUM7Q0FDdEI7QUFFRCxNQUFNLFdBQVcsZ0JBQWdCO0lBQy9CLElBQUksRUFBRSxNQUFNLENBQUM7SUFDYixHQUFHLEVBQUUsT0FBTyxDQUFDO0lBQ2IsUUFBUSxFQUFFLE1BQU0sQ0FBQztJQUNqQixhQUFhLEVBQUUsT0FBTyxDQUFDO0lBQ3ZCLGdCQUFnQixDQUFDLEVBQUUsT0FBTyxDQUFDO0NBQzVCO0FBRUQsTUFBTSxXQUFXLFlBQVk7SUFDM0IsSUFBSSxFQUFFLE1BQU0sQ0FBQztJQUNiLFFBQVEsRUFBRSxNQUFNLENBQUM7SUFDakIsT0FBTyxFQUFFLGdCQUFnQixDQUFDO0NBQzNCO0FBRUQsK0ZBQStGO0FBQy9GLHdCQUFzQixpQkFBaUIsQ0FBQyxTQUFTLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxZQUFZLEVBQUUsQ0FBQyxDQWtCbEYifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/artifacts.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,+FAA+F;AAC/F,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAkBlF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { readFile, readdir } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
/** Reads all JSON artifact files from a target directory and returns their parsed contents. */ export async function readArtifactFiles(targetDir) {
|
|
4
|
+
let entries;
|
|
5
|
+
try {
|
|
6
|
+
entries = (await readdir(targetDir)).filter((f)=>f.endsWith('.json'));
|
|
7
|
+
} catch (err) {
|
|
8
|
+
if (err?.code === 'ENOENT') {
|
|
9
|
+
throw new Error(`Target directory '${targetDir}' does not exist. Compile first with 'aztec compile'.`);
|
|
10
|
+
}
|
|
11
|
+
throw err;
|
|
12
|
+
}
|
|
13
|
+
const artifacts = [];
|
|
14
|
+
for (const file of entries){
|
|
15
|
+
const filePath = join(targetDir, file);
|
|
16
|
+
const content = JSON.parse(await readFile(filePath, 'utf-8'));
|
|
17
|
+
artifacts.push({
|
|
18
|
+
name: file.replace('.json', ''),
|
|
19
|
+
filePath,
|
|
20
|
+
content
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return artifacts;
|
|
24
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if recompilation is needed: either no artifacts exist in target/ or any .nr or Nargo.toml source file
|
|
3
|
+
* (including path-based dependencies) is newer than the oldest artifact. We compare against the oldest artifact so
|
|
4
|
+
* that a source change between the oldest and newest compilation (e.g. in a multi-contract workspace) still triggers
|
|
5
|
+
* a recompile.
|
|
6
|
+
*
|
|
7
|
+
* Note: The above implies that if there is a random json file in the target dir we would be always recompiling.
|
|
8
|
+
*/
|
|
9
|
+
export declare function needsRecompile(): Promise<boolean>;
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmVlZHNfcmVjb21waWxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvbmVlZHNfcmVjb21waWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0IsY0FBYyxJQUFJLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FXdkQifQ==
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { readdir, stat } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { collectCrateDirs } from './collect_crate_dirs.js';
|
|
4
|
+
/**
|
|
5
|
+
* Returns true if recompilation is needed: either no artifacts exist in target/ or any .nr or Nargo.toml source file
|
|
6
|
+
* (including path-based dependencies) is newer than the oldest artifact. We compare against the oldest artifact so
|
|
7
|
+
* that a source change between the oldest and newest compilation (e.g. in a multi-contract workspace) still triggers
|
|
8
|
+
* a recompile.
|
|
9
|
+
*
|
|
10
|
+
* Note: The above implies that if there is a random json file in the target dir we would be always recompiling.
|
|
11
|
+
*/ export async function needsRecompile() {
|
|
12
|
+
const oldestArtifactMs = await getOldestArtifactModificationTime('target');
|
|
13
|
+
if (oldestArtifactMs === undefined) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
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
|
+
});
|
|
22
|
+
return hasNewerSourceFile(crateDirs, oldestArtifactMs);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns the last modification time (timestamp in ms) of the oldest .json artifact in targetDir, or undefined if
|
|
26
|
+
* none exist.
|
|
27
|
+
*/ async function getOldestArtifactModificationTime(targetDir) {
|
|
28
|
+
let entries;
|
|
29
|
+
try {
|
|
30
|
+
entries = (await readdir(targetDir)).filter((f)=>f.endsWith('.json'));
|
|
31
|
+
} catch (err) {
|
|
32
|
+
if (err?.code === 'ENOENT') {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
if (entries.length === 0) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
let oldest = Infinity;
|
|
41
|
+
for (const entry of entries){
|
|
42
|
+
const s = await stat(join(targetDir, entry));
|
|
43
|
+
if (s.mtimeMs < oldest) {
|
|
44
|
+
oldest = s.mtimeMs;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return oldest;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Walks crate dirs looking for .nr and Nargo.toml files newer than thresholdMs. Short-circuits on the first match.
|
|
51
|
+
*/ async function hasNewerSourceFile(crateDirs, thresholdMs) {
|
|
52
|
+
// Returns true if it find a new file than thresholdMs, false otherwise
|
|
53
|
+
async function walkForNewer(dir) {
|
|
54
|
+
let entries;
|
|
55
|
+
try {
|
|
56
|
+
entries = await readdir(dir, {
|
|
57
|
+
withFileTypes: true
|
|
58
|
+
});
|
|
59
|
+
} catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
// We iterate over the entries in the dir
|
|
63
|
+
for (const entry of entries){
|
|
64
|
+
const fullPath = join(dir, entry.name);
|
|
65
|
+
if (entry.isDirectory()) {
|
|
66
|
+
// If the entry is a dir and it's not called `target` we recursively enter it
|
|
67
|
+
if (entry.name === 'target') {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (await walkForNewer(fullPath)) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
} else if (entry.name === 'Nargo.toml' || entry.name.endsWith('.nr')) {
|
|
74
|
+
// The entry is a Nargo.toml file or *.nr file so we check the timestamp
|
|
75
|
+
const s = await stat(fullPath);
|
|
76
|
+
if (s.mtimeMs > thresholdMs) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
// We search through the crate dirs
|
|
84
|
+
for (const dir of crateDirs){
|
|
85
|
+
if (await walkForNewer(dir)) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Spawns a command with inherited stdio and rejects on non-zero exit. */
|
|
2
|
+
export declare function run(cmd: string, args: string[]): Promise<void>;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Bhd24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jbGkvY21kcy91dGlscy9zcGF3bi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSwwRUFBMEU7QUFDMUUsd0JBQWdCLEdBQUcsQ0FBQyxHQUFHLEVBQUUsTUFBTSxFQUFFLElBQUksRUFBRSxNQUFNLEVBQUUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBWTlEIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/spawn.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAY9D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
/** Spawns a command with inherited stdio and rejects on non-zero exit. */ export function run(cmd, args) {
|
|
3
|
+
return new Promise((resolve, reject)=>{
|
|
4
|
+
const child = spawn(cmd, args, {
|
|
5
|
+
stdio: 'inherit'
|
|
6
|
+
});
|
|
7
|
+
child.on('error', reject);
|
|
8
|
+
child.on('close', (code)=>{
|
|
9
|
+
if (code !== 0) {
|
|
10
|
+
reject(new Error(`${cmd} exited with code ${code}`));
|
|
11
|
+
} else {
|
|
12
|
+
resolve();
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec-labs/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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2Fybl9pZl9henRlY192ZXJzaW9uX21pc21hdGNoLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvd2Fybl9pZl9henRlY192ZXJzaW9uX21pc21hdGNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBMEJ4RCxpSEFBaUg7QUFDakgsd0JBQXNCLDBCQUEwQixDQUFDLEdBQUcsRUFBRSxLQUFLLEVBQUUsVUFBVSxDQUFDLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0ErQy9GIn0=
|
|
@@ -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,4BAA4B,CAAC;AA0BxD,iHAAiH;AACjH,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+C/F"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { DEV_VERSION, getPackageVersion } from '@aztec-labs/stdlib/update-checker';
|
|
2
|
+
import TOML from '@iarna/toml';
|
|
3
|
+
import { readFile } from 'fs/promises';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { collectCrateDirs } from './collect_crate_dirs.js';
|
|
6
|
+
/** Returns true if the given git URL points to the AztecProtocol/aztec-nr repository. */ function isAztecNrGitUrl(gitUrl) {
|
|
7
|
+
let url;
|
|
8
|
+
try {
|
|
9
|
+
url = new URL(gitUrl);
|
|
10
|
+
} catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
if (url.hostname !== 'github.com') {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const repoPath = url.pathname.replace(/^\//, '').replace(/\.git$/, '').replace(/\/$/, '');
|
|
17
|
+
return repoPath === 'AztecProtocol/aztec-nr';
|
|
18
|
+
}
|
|
19
|
+
/** Warns if any aztec-nr git dependency in a crate's Nargo.toml has a tag that doesn't match the CLI version. */ export async function warnIfAztecVersionMismatch(log, cliVersion) {
|
|
20
|
+
const version = cliVersion ?? getPackageVersion();
|
|
21
|
+
if (version === DEV_VERSION) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const expectedTag = `v${version}`;
|
|
25
|
+
const mismatches = [];
|
|
26
|
+
const crateDirs = await collectCrateDirs('.', {
|
|
27
|
+
skipGitDeps: true
|
|
28
|
+
});
|
|
29
|
+
for (const dir of crateDirs){
|
|
30
|
+
const tomlPath = join(dir, 'Nargo.toml');
|
|
31
|
+
let content;
|
|
32
|
+
try {
|
|
33
|
+
content = await readFile(tomlPath, 'utf-8');
|
|
34
|
+
} catch {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const parsed = TOML.parse(content);
|
|
38
|
+
const deps = parsed.dependencies ?? {};
|
|
39
|
+
for (const [depName, dep] of Object.entries(deps)){
|
|
40
|
+
// Skip non-object deps (e.g. malformed entries) and anything that isn't a tagged git dep.
|
|
41
|
+
if (!dep || typeof dep !== 'object' || typeof dep.git !== 'string' || typeof dep.tag !== 'string') {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
// Only flag deps that are sourced from the aztec-nr repo.
|
|
45
|
+
if (!isAztecNrGitUrl(dep.git)) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (dep.tag !== expectedTag) {
|
|
49
|
+
mismatches.push({
|
|
50
|
+
file: tomlPath,
|
|
51
|
+
depName,
|
|
52
|
+
tag: dep.tag
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (mismatches.length > 0) {
|
|
58
|
+
const details = mismatches.map((m)=>` ${m.file} — ${m.depName} (${m.tag})`).join('\n');
|
|
59
|
+
log(`WARNING: Aztec dependency version mismatch detected.\n` + `The following aztec-nr dependencies do not match the CLI version (${expectedTag}):\n` + `${details}\n\n` + `See https://docs.aztec.network/errors/9 for how to update your dependencies.`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cli.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { LogFn, Logger } from '@aztec-labs/foundation/log';
|
|
2
|
+
export declare function preloadCrs(_options: any, userLog: LogFn, _debugLogger: Logger): Promise<void>;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJlbG9hZF9jcnMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbGkvcHJlbG9hZF9jcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBSWhFLHdCQUFzQixVQUFVLENBQUMsUUFBUSxFQUFFLEdBQUcsRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUVuRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preload_crs.d.ts","sourceRoot":"","sources":["../../src/cli/preload_crs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAIhE,wBAAsB,UAAU,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,iBAEnF"}
|