@aztec/aztec 0.0.1-commit.d431d1c → 0.0.1-commit.d58ff9d0
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 +9 -3
- 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 +1 -1
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +69 -32
- 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 +43 -25
- package/dest/cli/cli.d.ts +1 -1
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +3 -4
- 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/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 +3 -3
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +17 -9
- 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 +82 -51
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts +2 -2
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts.map +1 -1
- package/dest/cli/cmds/start_p2p_bootstrap.js +1 -2
- 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 +6 -18
- 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 +24 -15
- package/dest/cli/cmds/start_txe.d.ts +2 -2
- package/dest/cli/cmds/start_txe.d.ts.map +1 -1
- package/dest/cli/cmds/start_txe.js +6 -5
- 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/util.d.ts +13 -19
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +37 -100
- package/dest/examples/token.js +12 -12
- 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 +3 -2
- package/dest/local-network/banana_fpc.d.ts.map +1 -1
- package/dest/local-network/banana_fpc.js +13 -9
- package/dest/local-network/local-network.d.ts +12 -33
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +83 -73
- package/dest/testing/cheat_codes.d.ts +17 -23
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +17 -43
- package/dest/testing/epoch_test_settler.d.ts +5 -3
- package/dest/testing/epoch_test_settler.d.ts.map +1 -1
- package/dest/testing/epoch_test_settler.js +14 -24
- package/dest/testing/index.d.ts +3 -2
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +2 -1
- 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 +35 -34
- package/scripts/add_crate.sh +53 -0
- package/scripts/aztec.sh +15 -5
- package/scripts/init.sh +23 -19
- package/scripts/new.sh +48 -24
- 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 +9 -3
- package/src/cli/admin_api_key_store.ts +128 -0
- package/src/cli/aztec_start_action.ts +69 -24
- package/src/cli/aztec_start_options.ts +51 -31
- package/src/cli/cli.ts +3 -4
- package/src/cli/cmds/compile.ts +205 -0
- package/src/cli/cmds/profile.ts +26 -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 +42 -0
- package/src/cli/cmds/standby.ts +184 -0
- package/src/cli/cmds/start_bot.ts +17 -11
- package/src/cli/cmds/start_node.ts +92 -52
- package/src/cli/cmds/start_p2p_bootstrap.ts +2 -2
- package/src/cli/cmds/start_prover_agent.ts +7 -10
- package/src/cli/cmds/start_prover_broker.ts +28 -25
- package/src/cli/cmds/start_txe.ts +7 -5
- 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 +76 -0
- package/src/cli/util.ts +39 -118
- package/src/examples/token.ts +21 -13
- package/src/local-network/auth_registry.ts +19 -0
- package/src/local-network/banana_fpc.ts +16 -8
- package/src/local-network/local-network.ts +96 -79
- package/src/testing/cheat_codes.ts +18 -49
- package/src/testing/epoch_test_settler.ts +14 -26
- package/src/testing/index.ts +2 -1
- package/src/testing/local-network.ts +97 -0
- package/src/testing/token_allowed_setup.ts +26 -0
- package/dest/cli/cmds/start_archiver.d.ts +0 -9
- package/dest/cli/cmds/start_archiver.d.ts.map +0 -1
- package/dest/cli/cmds/start_archiver.js +0 -48
- package/dest/cli/cmds/start_prover_node.d.ts +0 -7
- package/dest/cli/cmds/start_prover_node.d.ts.map +0 -1
- package/dest/cli/cmds/start_prover_node.js +0 -108
- 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/dest/testing/anvil_test_watcher.d.ts +0 -34
- package/dest/testing/anvil_test_watcher.d.ts.map +0 -1
- package/dest/testing/anvil_test_watcher.js +0 -144
- package/scripts/compile.sh +0 -44
- package/scripts/extract_function.js +0 -47
- package/scripts/flamegraph.sh +0 -59
- package/scripts/setup_project.sh +0 -31
- package/src/cli/cmds/start_archiver.ts +0 -50
- package/src/cli/cmds/start_prover_node.ts +0 -124
- package/src/cli/release_version.ts +0 -21
- package/src/testing/anvil_test_watcher.ts +0 -166
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
initTelemetryClient,
|
|
11
11
|
makeTracedFetch,
|
|
12
12
|
} from '@aztec/telemetry-client';
|
|
13
|
-
import {
|
|
13
|
+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
14
14
|
|
|
15
|
-
import { extractRelevantOptions } from '../util.js';
|
|
15
|
+
import { extractRelevantOptions, stringifyConfig } from '../util.js';
|
|
16
16
|
import { getVersions } from '../versioning.js';
|
|
17
17
|
|
|
18
18
|
export async function startBot(
|
|
@@ -21,11 +21,9 @@ export async function startBot(
|
|
|
21
21
|
services: NamespacedApiHandlers,
|
|
22
22
|
userLog: LogFn,
|
|
23
23
|
) {
|
|
24
|
-
const { proverNode,
|
|
25
|
-
if (proverNode ||
|
|
26
|
-
userLog(
|
|
27
|
-
`Starting a bot with --prover-node, --prover, --archiver, --sequencer, --p2p-bootstrap, or --txe is not supported.`,
|
|
28
|
-
);
|
|
24
|
+
const { proverNode, sequencer, p2pBootstrap, txe, prover } = options;
|
|
25
|
+
if (proverNode || sequencer || p2pBootstrap || txe || prover) {
|
|
26
|
+
userLog(`Starting a bot with --prover-node, --prover, --sequencer, --p2p-bootstrap, or --txe is not supported.`);
|
|
29
27
|
process.exit(1);
|
|
30
28
|
}
|
|
31
29
|
|
|
@@ -38,22 +36,30 @@ export async function startBot(
|
|
|
38
36
|
const aztecNode = createAztecNodeClient(config.nodeUrl, getVersions(), fetch);
|
|
39
37
|
|
|
40
38
|
const pxeConfig = extractRelevantOptions<PXEConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
|
|
41
|
-
|
|
39
|
+
userLog(`Creating bot wallet with config ${stringifyConfig(pxeConfig)}`);
|
|
40
|
+
const wallet = await EmbeddedWallet.create(aztecNode, { pxeConfig });
|
|
42
41
|
|
|
43
42
|
const telemetry = await initTelemetryClient(getTelemetryClientConfig());
|
|
44
|
-
await addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, undefined);
|
|
43
|
+
await addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, undefined, userLog);
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
export async function addBot(
|
|
48
47
|
options: any,
|
|
49
48
|
signalHandlers: (() => Promise<void>)[],
|
|
50
49
|
services: NamespacedApiHandlers,
|
|
51
|
-
wallet:
|
|
50
|
+
wallet: EmbeddedWallet,
|
|
52
51
|
aztecNode: AztecNode,
|
|
53
52
|
telemetry: TelemetryClient,
|
|
54
53
|
aztecNodeAdmin?: AztecNodeAdmin,
|
|
54
|
+
userLog?: LogFn,
|
|
55
55
|
) {
|
|
56
56
|
const config = extractRelevantOptions<BotConfig>(options, botConfigMappings, 'bot');
|
|
57
|
+
userLog?.(`Starting bot with config ${stringifyConfig(config)}`);
|
|
58
|
+
|
|
59
|
+
// The bot wallet's embedded PXE syncs to this tip (see start_bot.ts/start_node.ts which build the wallet from the
|
|
60
|
+
// same options). L1-to-L2 readiness checks must be evaluated at this tip rather than at 'latest', or the bot can
|
|
61
|
+
// consider a message ready while the PXE simulation anchors to an older block that cannot prove its membership yet.
|
|
62
|
+
const { syncChainTip } = extractRelevantOptions<PXEConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
|
|
57
63
|
|
|
58
64
|
const db = await (config.dataDirectory
|
|
59
65
|
? createStore('bot', BotStore.SCHEMA_VERSION, config)
|
|
@@ -62,7 +68,7 @@ export async function addBot(
|
|
|
62
68
|
const store = new BotStore(db);
|
|
63
69
|
await store.cleanupOldClaims();
|
|
64
70
|
|
|
65
|
-
const botRunner = new BotRunner(config, wallet, aztecNode, telemetry, aztecNodeAdmin, store);
|
|
71
|
+
const botRunner = new BotRunner(config, wallet, aztecNode, telemetry, aztecNodeAdmin, store, syncChainTip);
|
|
66
72
|
if (!config.noStart) {
|
|
67
73
|
void botRunner.start(); // Do not block since bot setup takes time
|
|
68
74
|
}
|
|
@@ -1,30 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
type AztecNodeConfig,
|
|
3
|
+
aztecNodeConfigMappings,
|
|
4
|
+
getConfigEnvVars,
|
|
5
|
+
registerAztecNodeRpcHandlers,
|
|
6
|
+
} from '@aztec/aztec-node';
|
|
3
7
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
-
import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
|
|
5
8
|
import { getL1Config } from '@aztec/cli/config';
|
|
6
|
-
import {
|
|
7
|
-
import { SecretValue } from '@aztec/foundation/config';
|
|
9
|
+
import { getGenesisStateConfigEnvVars } from '@aztec/ethereum/config';
|
|
10
|
+
import { type NetworkNames, SecretValue } from '@aztec/foundation/config';
|
|
8
11
|
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
12
|
+
import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
|
|
9
13
|
import type { LogFn } from '@aztec/foundation/log';
|
|
14
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
15
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
16
|
+
import {
|
|
17
|
+
ProvingJobConsumerSchema,
|
|
18
|
+
createProvingJobBrokerClient,
|
|
19
|
+
proverBrokerBackoff,
|
|
20
|
+
} from '@aztec/prover-client/broker';
|
|
10
21
|
import { type CliPXEOptions, type PXEConfig, allPxeConfigMappings } from '@aztec/pxe/config';
|
|
11
|
-
import {
|
|
12
|
-
import { P2PApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
22
|
+
import { ProverNodeApiSchema, type ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
|
|
13
23
|
import {
|
|
14
24
|
type TelemetryClientConfig,
|
|
15
25
|
initTelemetryClient,
|
|
26
|
+
makeTracedFetch,
|
|
16
27
|
telemetryClientConfigMappings,
|
|
17
28
|
} from '@aztec/telemetry-client';
|
|
18
|
-
import {
|
|
19
|
-
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
29
|
+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
20
30
|
|
|
21
31
|
import { createAztecNode } from '../../local-network/index.js';
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
setupUpdateMonitor,
|
|
27
|
-
} from '../util.js';
|
|
32
|
+
import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying } from '../util.js';
|
|
33
|
+
import { getVersions } from '../versioning.js';
|
|
34
|
+
import { computeExpectedGenesisRoot, setupAutoShutdown, waitForCompatibleRollup } from './standby.js';
|
|
35
|
+
import { startProverBroker } from './start_prover_broker.js';
|
|
28
36
|
|
|
29
37
|
export async function startNode(
|
|
30
38
|
options: any,
|
|
@@ -32,6 +40,7 @@ export async function startNode(
|
|
|
32
40
|
services: NamespacedApiHandlers,
|
|
33
41
|
adminServices: NamespacedApiHandlers,
|
|
34
42
|
userLog: LogFn,
|
|
43
|
+
networkName: NetworkNames,
|
|
35
44
|
): Promise<{ config: AztecNodeConfig }> {
|
|
36
45
|
// All options set from environment variables
|
|
37
46
|
const configFromEnvVars = getConfigEnvVars();
|
|
@@ -45,31 +54,53 @@ export async function startNode(
|
|
|
45
54
|
...relevantOptions,
|
|
46
55
|
};
|
|
47
56
|
|
|
57
|
+
// Prover node configuration and broker setup
|
|
58
|
+
// REFACTOR: Move the broker setup out of here and into the prover-node factory
|
|
59
|
+
let broker: ProvingJobBroker | undefined = undefined;
|
|
48
60
|
if (options.proverNode) {
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
nodeConfig.enableProverNode = true;
|
|
62
|
+
if (nodeConfig.proverAgentCount === 0) {
|
|
63
|
+
userLog(
|
|
64
|
+
`Running prover node without local prover agent. Connect prover agents or pass --proverAgent.proverAgentCount`,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
if (nodeConfig.proverBrokerUrl) {
|
|
68
|
+
// at 1TPS we'd enqueue ~1k chonk verifier proofs and ~1k AVM proofs immediately
|
|
69
|
+
// set a lower connection limit such that we don't overload the server
|
|
70
|
+
// Retry indefinitely until the epoch proving times out and the chain reorgs
|
|
71
|
+
const fetch = makeTracedFetch(proverBrokerBackoff, false, makeUndiciFetch(new Agent({ connections: 100 })));
|
|
72
|
+
broker = createProvingJobBrokerClient(nodeConfig.proverBrokerUrl, getVersions(nodeConfig), fetch);
|
|
73
|
+
} else if (options.proverBroker) {
|
|
74
|
+
({ broker } = await startProverBroker(options, signalHandlers, services, userLog));
|
|
75
|
+
} else {
|
|
76
|
+
userLog(`--prover-broker-url or --prover-broker is required to start a Prover Node`);
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
51
79
|
}
|
|
52
80
|
|
|
53
81
|
await preloadCrsDataForVerifying(nodeConfig, userLog);
|
|
54
82
|
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts);
|
|
58
|
-
|
|
59
|
-
userLog(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`);
|
|
60
|
-
|
|
61
|
-
const { genesisArchiveRoot, prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
|
|
62
|
-
|
|
63
|
-
userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
|
|
83
|
+
const genesisConfig = getGenesisStateConfigEnvVars();
|
|
84
|
+
const { genesisArchiveRoot, genesis } = await computeExpectedGenesisRoot(genesisConfig, userLog);
|
|
64
85
|
|
|
65
86
|
const followsCanonicalRollup =
|
|
66
87
|
typeof nodeConfig.rollupVersion !== 'number' || (nodeConfig.rollupVersion as unknown as string) === 'canonical';
|
|
67
88
|
|
|
68
|
-
if (!nodeConfig.
|
|
89
|
+
if (!nodeConfig.registryAddress || nodeConfig.registryAddress.isZero()) {
|
|
69
90
|
throw new Error('L1 registry address is required to start Aztec Node');
|
|
70
91
|
}
|
|
92
|
+
|
|
93
|
+
// Wait for a compatible rollup before proceeding with full L1 config fetch.
|
|
94
|
+
// This prevents crashes when the canonical rollup hasn't been upgraded yet.
|
|
95
|
+
await waitForCompatibleRollup(
|
|
96
|
+
nodeConfig,
|
|
97
|
+
{ genesisArchiveRoot, vkTreeRoot: getVKTreeRoot(), protocolContractsHash },
|
|
98
|
+
options.port,
|
|
99
|
+
userLog,
|
|
100
|
+
);
|
|
101
|
+
|
|
71
102
|
const { addresses, config } = await getL1Config(
|
|
72
|
-
nodeConfig.
|
|
103
|
+
nodeConfig.registryAddress,
|
|
73
104
|
nodeConfig.l1RpcUrls,
|
|
74
105
|
nodeConfig.l1ChainId,
|
|
75
106
|
nodeConfig.rollupVersion,
|
|
@@ -83,13 +114,9 @@ export async function startNode(
|
|
|
83
114
|
);
|
|
84
115
|
}
|
|
85
116
|
|
|
86
|
-
// TODO(#12272): will clean this up.
|
|
87
117
|
nodeConfig = {
|
|
88
118
|
...nodeConfig,
|
|
89
|
-
|
|
90
|
-
...addresses,
|
|
91
|
-
slashFactoryAddress: nodeConfig.l1Contracts.slashFactoryAddress,
|
|
92
|
-
},
|
|
119
|
+
...addresses,
|
|
93
120
|
...config,
|
|
94
121
|
};
|
|
95
122
|
|
|
@@ -101,12 +128,17 @@ export async function startNode(
|
|
|
101
128
|
...extractNamespacedOptions(options, 'sequencer'),
|
|
102
129
|
};
|
|
103
130
|
// If no publisher private keys have been given, use the first validator key
|
|
104
|
-
if (
|
|
131
|
+
if (
|
|
132
|
+
sequencerConfig.sequencerPublisherPrivateKeys === undefined ||
|
|
133
|
+
!sequencerConfig.sequencerPublisherPrivateKeys.length
|
|
134
|
+
) {
|
|
105
135
|
if (sequencerConfig.validatorPrivateKeys?.getValue().length) {
|
|
106
|
-
sequencerConfig.
|
|
136
|
+
sequencerConfig.sequencerPublisherPrivateKeys = [
|
|
137
|
+
new SecretValue(sequencerConfig.validatorPrivateKeys.getValue()[0]),
|
|
138
|
+
];
|
|
107
139
|
}
|
|
108
140
|
}
|
|
109
|
-
nodeConfig.
|
|
141
|
+
nodeConfig.sequencerPublisherPrivateKeys = sequencerConfig.sequencerPublisherPrivateKeys;
|
|
110
142
|
}
|
|
111
143
|
|
|
112
144
|
if (nodeConfig.p2pEnabled) {
|
|
@@ -120,12 +152,18 @@ export async function startNode(
|
|
|
120
152
|
const telemetry = await initTelemetryClient(telemetryConfig);
|
|
121
153
|
|
|
122
154
|
// Create and start Aztec Node
|
|
123
|
-
const node = await createAztecNode(nodeConfig, { telemetry }, {
|
|
155
|
+
const node = await createAztecNode(nodeConfig, { telemetry, proverBroker: broker }, { genesis });
|
|
156
|
+
|
|
157
|
+
registerAztecNodeRpcHandlers(node, services, adminServices, { debug: options.nodeDebug });
|
|
124
158
|
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
159
|
+
// Register prover-node services if the prover node subsystem is running
|
|
160
|
+
const proverNode = node.getProverNode();
|
|
161
|
+
if (proverNode) {
|
|
162
|
+
adminServices.prover = [proverNode, ProverNodeApiSchema];
|
|
163
|
+
if (!nodeConfig.proverBrokerUrl) {
|
|
164
|
+
services.provingJobSource = [proverNode.getProver().getProvingJobSource(), ProvingJobConsumerSchema];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
129
167
|
|
|
130
168
|
// Add node stop function to signal handlers
|
|
131
169
|
signalHandlers.push(node.stop.bind(node));
|
|
@@ -135,21 +173,23 @@ export async function startNode(
|
|
|
135
173
|
const { addBot } = await import('./start_bot.js');
|
|
136
174
|
|
|
137
175
|
const pxeConfig = extractRelevantOptions<PXEConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
|
|
138
|
-
const wallet = await
|
|
176
|
+
const wallet = await EmbeddedWallet.create(node, { pxeConfig });
|
|
139
177
|
|
|
140
178
|
await addBot(options, signalHandlers, services, wallet, node, telemetry, undefined);
|
|
141
179
|
}
|
|
142
180
|
|
|
143
|
-
if (nodeConfig.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
181
|
+
if (nodeConfig.enableAutoShutdown && networkName !== 'local' && followsCanonicalRollup) {
|
|
182
|
+
try {
|
|
183
|
+
await setupAutoShutdown(
|
|
184
|
+
nodeConfig,
|
|
185
|
+
nodeConfig.registryAddress,
|
|
186
|
+
(nodeConfig.rollupVersion as number | 'canonical') ?? 'canonical',
|
|
187
|
+
{ genesisArchiveRoot, vkTreeRoot: getVKTreeRoot(), protocolContractsHash },
|
|
188
|
+
signalHandlers,
|
|
189
|
+
);
|
|
190
|
+
} catch {
|
|
191
|
+
/* no-op */
|
|
192
|
+
}
|
|
153
193
|
}
|
|
154
194
|
|
|
155
195
|
return { config: nodeConfig };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
2
2
|
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
3
|
-
import {
|
|
3
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
import { createStore } from '@aztec/kv-store/lmdb-v2';
|
|
5
5
|
import { type BootnodeConfig, BootstrapNode, bootnodeConfigMappings } from '@aztec/p2p';
|
|
6
6
|
import { emptyChainConfig } from '@aztec/stdlib/config';
|
|
@@ -27,7 +27,7 @@ export async function startP2PBootstrap(
|
|
|
27
27
|
const telemetryConfig = extractRelevantOptions<TelemetryClientConfig>(options, telemetryClientConfigMappings, 'tel');
|
|
28
28
|
const telemetryClient = await initTelemetryClient(telemetryConfig);
|
|
29
29
|
|
|
30
|
-
const store = await createStore('p2p-bootstrap', 1, config
|
|
30
|
+
const store = await createStore('p2p-bootstrap', 1, config);
|
|
31
31
|
const node = new BootstrapNode(store, telemetryClient);
|
|
32
32
|
await node.start(config);
|
|
33
33
|
signalHandlers.push(() => node.stop());
|
|
@@ -4,11 +4,12 @@ import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
|
|
|
4
4
|
import type { LogFn } from '@aztec/foundation/log';
|
|
5
5
|
import { buildServerCircuitProver } from '@aztec/prover-client';
|
|
6
6
|
import {
|
|
7
|
-
InlineProofStore,
|
|
8
7
|
type ProverAgentConfig,
|
|
9
8
|
ProvingAgent,
|
|
9
|
+
createProofStore,
|
|
10
10
|
createProvingJobBrokerClient,
|
|
11
11
|
proverAgentConfigMappings,
|
|
12
|
+
proverBrokerBackoff,
|
|
12
13
|
} from '@aztec/prover-client/broker';
|
|
13
14
|
import { getProverNodeAgentConfigFromEnv } from '@aztec/prover-node';
|
|
14
15
|
import { ProverAgentApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
@@ -23,8 +24,8 @@ export async function startProverAgent(
|
|
|
23
24
|
services: NamespacedApiHandlers,
|
|
24
25
|
userLog: LogFn,
|
|
25
26
|
) {
|
|
26
|
-
if (options.node || options.sequencer || options.
|
|
27
|
-
userLog(`Starting a prover agent with --node, --sequencer, --
|
|
27
|
+
if (options.node || options.sequencer || options.p2pBootstrap || options.txe) {
|
|
28
|
+
userLog(`Starting a prover agent with --node, --sequencer, --p2p-bootstrap, or --txe is not supported.`);
|
|
28
29
|
process.exit(1);
|
|
29
30
|
}
|
|
30
31
|
|
|
@@ -45,17 +46,13 @@ export async function startProverAgent(
|
|
|
45
46
|
|
|
46
47
|
await preloadCrsDataForServerSideProving(config, userLog);
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
[1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3],
|
|
51
|
-
false,
|
|
52
|
-
makeUndiciFetch(new Agent({ connections: 10 })),
|
|
53
|
-
);
|
|
49
|
+
// Retry indefinitely until the epoch proving times out and the chain reorgs
|
|
50
|
+
const fetch = makeTracedFetch(proverBrokerBackoff, false, makeUndiciFetch(new Agent({ connections: 10 })));
|
|
54
51
|
const broker = createProvingJobBrokerClient(config.proverBrokerUrl, getVersions(), fetch);
|
|
55
52
|
|
|
56
53
|
const telemetry = await initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
|
|
57
54
|
const prover = await buildServerCircuitProver(config, telemetry);
|
|
58
|
-
const proofStore =
|
|
55
|
+
const proofStore = await createProofStore(config.proofStore);
|
|
59
56
|
const agents = times(
|
|
60
57
|
config.proverAgentCount,
|
|
61
58
|
() => new ProvingAgent(broker, proofStore, prover, config.proverAgentProofTypes, config.proverAgentPollIntervalMs),
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { getL1Config } from '@aztec/cli/config';
|
|
2
|
-
import {
|
|
2
|
+
import { getGenesisStateConfigEnvVars } from '@aztec/ethereum/config';
|
|
3
3
|
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
4
4
|
import type { LogFn } from '@aztec/foundation/log';
|
|
5
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
6
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
5
7
|
import {
|
|
6
8
|
type ProverBrokerConfig,
|
|
7
9
|
ProvingJobBrokerSchema,
|
|
10
|
+
ProvingJobBrokerSchemaWithDebug,
|
|
8
11
|
createAndStartProvingBroker,
|
|
9
12
|
proverBrokerConfigMappings,
|
|
10
13
|
} from '@aztec/prover-client/broker';
|
|
@@ -12,7 +15,8 @@ import { getProverNodeBrokerConfigFromEnv } from '@aztec/prover-node';
|
|
|
12
15
|
import type { ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
|
|
13
16
|
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
14
17
|
|
|
15
|
-
import { extractRelevantOptions
|
|
18
|
+
import { extractRelevantOptions } from '../util.js';
|
|
19
|
+
import { computeExpectedGenesisRoot, waitForCompatibleRollup } from './standby.js';
|
|
16
20
|
|
|
17
21
|
export async function startProverBroker(
|
|
18
22
|
options: any,
|
|
@@ -20,46 +24,45 @@ export async function startProverBroker(
|
|
|
20
24
|
services: NamespacedApiHandlers,
|
|
21
25
|
userLog: LogFn,
|
|
22
26
|
): Promise<{ broker: ProvingJobBroker; config: ProverBrokerConfig }> {
|
|
23
|
-
if (options.node || options.sequencer || options.
|
|
24
|
-
userLog(`Starting a prover broker with --node, --sequencer, --
|
|
27
|
+
if (options.node || options.sequencer || options.p2pBootstrap || options.txe) {
|
|
28
|
+
userLog(`Starting a prover broker with --node, --sequencer, --p2p-bootstrap, or --txe is not supported.`);
|
|
25
29
|
process.exit(1);
|
|
26
30
|
}
|
|
27
31
|
|
|
28
|
-
const
|
|
32
|
+
const baseConfig: ProverBrokerConfig = {
|
|
29
33
|
...getProverNodeBrokerConfigFromEnv(), // get default config from env
|
|
30
34
|
...extractRelevantOptions<ProverBrokerConfig>(options, proverBrokerConfigMappings, 'proverBroker'), // override with command line options
|
|
31
35
|
};
|
|
32
36
|
|
|
33
|
-
if (!
|
|
37
|
+
if (!baseConfig.registryAddress || baseConfig.registryAddress.isZero()) {
|
|
34
38
|
throw new Error('L1 registry address is required to start Aztec Node without --deploy-aztec-contracts option');
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
const
|
|
41
|
+
const genesisConfig = getGenesisStateConfigEnvVars();
|
|
42
|
+
const { genesisArchiveRoot } = await computeExpectedGenesisRoot(genesisConfig, userLog);
|
|
43
|
+
await waitForCompatibleRollup(
|
|
44
|
+
baseConfig,
|
|
45
|
+
{ genesisArchiveRoot, vkTreeRoot: getVKTreeRoot(), protocolContractsHash },
|
|
46
|
+
options.port,
|
|
47
|
+
userLog,
|
|
48
|
+
);
|
|
49
|
+
|
|
38
50
|
const { addresses, config: rollupConfig } = await getL1Config(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
baseConfig.registryAddress,
|
|
52
|
+
baseConfig.l1RpcUrls,
|
|
53
|
+
baseConfig.l1ChainId,
|
|
54
|
+
baseConfig.rollupVersion,
|
|
43
55
|
);
|
|
44
56
|
|
|
45
|
-
config
|
|
46
|
-
config.rollupVersion = rollupConfig.rollupVersion;
|
|
57
|
+
const config: ProverBrokerConfig = { ...baseConfig, ...addresses, rollupVersion: rollupConfig.rollupVersion };
|
|
47
58
|
|
|
48
59
|
const client = await initTelemetryClient(getTelemetryClientConfig());
|
|
49
60
|
const broker = await createAndStartProvingBroker(config, client);
|
|
50
61
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
followsCanonicalRollup,
|
|
56
|
-
getPublicClient(config),
|
|
57
|
-
config.l1Contracts.registryAddress,
|
|
58
|
-
signalHandlers,
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
services.proverBroker = [broker, ProvingJobBrokerSchema];
|
|
62
|
+
services.proverBroker = [
|
|
63
|
+
broker,
|
|
64
|
+
config.proverBrokerDebugReplayEnabled ? ProvingJobBrokerSchemaWithDebug : ProvingJobBrokerSchema,
|
|
65
|
+
];
|
|
63
66
|
signalHandlers.push(() => broker.stop());
|
|
64
67
|
|
|
65
68
|
return { broker, config };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
|
-
import { createTXERpcServer } from '@aztec/txe';
|
|
3
|
+
import { createTXERpcServer } from '@aztec/txe/server';
|
|
4
4
|
|
|
5
|
-
export async function startTXE(options: any, debugLogger: Logger) {
|
|
5
|
+
export async function startTXE(options: any, signalHandlers: Array<() => Promise<void>>, debugLogger: Logger) {
|
|
6
6
|
debugLogger.info(`Setting up TXE...`);
|
|
7
7
|
|
|
8
|
-
const txeServer = createTXERpcServer(debugLogger);
|
|
9
|
-
const
|
|
8
|
+
const txeServer = await createTXERpcServer(debugLogger);
|
|
9
|
+
const httpServer = await startHttpRpcServer(txeServer, {
|
|
10
10
|
port: options.port,
|
|
11
11
|
timeoutMs: 1e3 * 60 * 5,
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
signalHandlers.push(() => new Promise<void>(resolve => httpServer.close(() => resolve())));
|
|
15
|
+
|
|
16
|
+
debugLogger.info(`TXE listening on port ${httpServer.port}`);
|
|
15
17
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { readFile, readdir } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
|
|
4
|
+
export interface CompiledArtifact {
|
|
5
|
+
noir_version: string;
|
|
6
|
+
file_map: unknown;
|
|
7
|
+
functions: ContractFunction[];
|
|
8
|
+
bytecode?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Set to true by the AVM transpiler (invoked via `bb aztec_process`) once the contract has been transpiled and its
|
|
11
|
+
* verification keys generated. Absent on raw `nargo compile` output, hence optional.
|
|
12
|
+
*/
|
|
13
|
+
transpiled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ContractFunction {
|
|
17
|
+
name: string;
|
|
18
|
+
abi: unknown;
|
|
19
|
+
bytecode: string;
|
|
20
|
+
debug_symbols: unknown;
|
|
21
|
+
is_unconstrained?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ArtifactFile {
|
|
25
|
+
name: string;
|
|
26
|
+
filePath: string;
|
|
27
|
+
content: CompiledArtifact;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Reads all JSON artifact files from a target directory and returns their parsed contents. */
|
|
31
|
+
export async function readArtifactFiles(targetDir: string): Promise<ArtifactFile[]> {
|
|
32
|
+
let entries: string[];
|
|
33
|
+
try {
|
|
34
|
+
entries = (await readdir(targetDir)).filter(f => f.endsWith('.json'));
|
|
35
|
+
} catch (err: any) {
|
|
36
|
+
if (err?.code === 'ENOENT') {
|
|
37
|
+
throw new Error(`Target directory '${targetDir}' does not exist. Compile first with 'aztec compile'.`);
|
|
38
|
+
}
|
|
39
|
+
throw err;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const artifacts: ArtifactFile[] = [];
|
|
43
|
+
for (const file of entries) {
|
|
44
|
+
const filePath = join(targetDir, file);
|
|
45
|
+
const content = JSON.parse(await readFile(filePath, 'utf-8')) as CompiledArtifact;
|
|
46
|
+
artifacts.push({ name: file.replace('.json', ''), filePath, content });
|
|
47
|
+
}
|
|
48
|
+
return artifacts;
|
|
49
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
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
|
+
|
|
7
|
+
import { run } from './spawn.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Recursively collects crate directories starting from startCrateDir by following dependencies declared in Nargo.toml
|
|
11
|
+
* files.
|
|
12
|
+
*
|
|
13
|
+
* When `skipGitDeps` is false (default), git-based deps are followed and fetched into the nargo cache
|
|
14
|
+
* (`$HOME/nargo/<domain>/<repo-path>/<tag>`) if not already present.
|
|
15
|
+
*
|
|
16
|
+
* When `skipGitDeps` is true, git-based deps are ignored entirely.
|
|
17
|
+
*/
|
|
18
|
+
export async function collectCrateDirs(startCrateDir: string, opts?: { skipGitDeps?: boolean }): Promise<string[]> {
|
|
19
|
+
const { skipGitDeps = false } = opts ?? {};
|
|
20
|
+
const visited = new Set<string>();
|
|
21
|
+
|
|
22
|
+
async function visit(crateDir: string): Promise<void> {
|
|
23
|
+
const absDir = resolve(crateDir);
|
|
24
|
+
if (visited.has(absDir)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
visited.add(absDir);
|
|
28
|
+
|
|
29
|
+
const tomlPath = join(absDir, 'Nargo.toml');
|
|
30
|
+
const content = await readFile(tomlPath, 'utf-8').catch(() => {
|
|
31
|
+
throw new Error(`Incorrectly defined dependency. Nargo.toml not found in ${absDir}`);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const parsed = TOML.parse(content) as Record<string, any>;
|
|
35
|
+
const members = (parsed.workspace as Record<string, any>)?.members as string[] | undefined;
|
|
36
|
+
|
|
37
|
+
// A Nargo.toml is either a workspace root (has workspace.members) or a single crate (has dependencies).
|
|
38
|
+
if (Array.isArray(members)) {
|
|
39
|
+
// The crate is a workspace root and has members defined so we visit the members
|
|
40
|
+
for (const member of members) {
|
|
41
|
+
await visit(resolve(absDir, member));
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
// Single crate — follow its deps
|
|
45
|
+
const deps = (parsed.dependencies as Record<string, any>) ?? {};
|
|
46
|
+
for (const dep of Object.values(deps)) {
|
|
47
|
+
if (!dep || typeof dep !== 'object') {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (typeof dep.path === 'string') {
|
|
51
|
+
// Dependency contains "path" hence it's a local dependency. We just check it's a real directory and then we
|
|
52
|
+
// recursively search through it
|
|
53
|
+
const depPath = resolve(absDir, dep.path);
|
|
54
|
+
const s = await stat(depPath);
|
|
55
|
+
if (!s.isDirectory()) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`Dependency path "${dep.path}" in ${tomlPath} resolves to ${depPath} which is not a directory`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
await visit(depPath);
|
|
61
|
+
} else if (!skipGitDeps && typeof dep.git === 'string' && typeof dep.tag === 'string') {
|
|
62
|
+
// Dependency contains "git" hence it's a git dependency. We ensure it has been fetched and fetch it if
|
|
63
|
+
// it's not the case and then we recursively search through it.
|
|
64
|
+
await fetchAndVisit(dep.git, dep.tag, dep.directory);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function fetchAndVisit(gitUrl: string, tag: string, directory?: string): Promise<void> {
|
|
71
|
+
// `directory` is set when the dep lives in a subdirectory of a repository, e.g.:
|
|
72
|
+
// aztec = { git = "https://github.com/AztecProtocol/aztec-packages", tag = "v0.82.0",
|
|
73
|
+
// directory = "noir-projects/aztec-nr/aztec" }
|
|
74
|
+
// In that case nargo clones the whole repo and the crate root is <cachePath>/<directory>.
|
|
75
|
+
const cachePath = nargoGitDepPath(gitUrl, tag);
|
|
76
|
+
const crateDir = directory ? join(cachePath, directory) : cachePath;
|
|
77
|
+
await ensureGitDepCached(gitUrl, tag, cachePath);
|
|
78
|
+
await visit(crateDir);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
await visit(startCrateDir);
|
|
82
|
+
return [...visited];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Computes the local nargo cache path for a git dependency, mirroring nargo's own `git_dep_location` function.
|
|
87
|
+
* Path format: `$HOME/nargo/<domain>/<repo-path>/<tag>`
|
|
88
|
+
* e.g. `~/nargo/github.com/AztecProtocol/aztec-packages/v0.82.0`
|
|
89
|
+
*
|
|
90
|
+
* Source: noir/noir-repo/tooling/nargo_toml/src/git.rs
|
|
91
|
+
*/
|
|
92
|
+
export function nargoGitDepPath(gitUrl: string, tag: string): string {
|
|
93
|
+
const url = new URL(gitUrl);
|
|
94
|
+
const domain = url.hostname;
|
|
95
|
+
const repoPath = url.pathname.replace(/^\//, '');
|
|
96
|
+
return join(process.env.HOME ?? homedir(), 'nargo', domain, repoPath, tag);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Ensures a git dep is present in the nargo cache, cloning it if it isn't. Mirrors nargo's `clone_git_repo`.
|
|
101
|
+
* If cloning fails (e.g. no network), throws with a message suggesting `nargo check` to prime the cache.
|
|
102
|
+
*
|
|
103
|
+
* Source: noir/noir-repo/tooling/nargo_toml/src/git.rs
|
|
104
|
+
*/
|
|
105
|
+
async function ensureGitDepCached(gitUrl: string, tag: string, cachePath: string): Promise<void> {
|
|
106
|
+
if (existsSync(cachePath)) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
await mkdir(dirname(cachePath), { recursive: true });
|
|
110
|
+
try {
|
|
111
|
+
await run('git', ['-c', 'advice.detachedHead=false', 'clone', '--depth', '1', '--branch', tag, gitUrl, cachePath]);
|
|
112
|
+
} catch (err: any) {
|
|
113
|
+
throw new Error(
|
|
114
|
+
`Failed to fetch git dependency ${gitUrl}@${tag}: ${err?.message ?? err}.\n` +
|
|
115
|
+
`Try running \`nargo check\` first to prime the dependency cache.`,
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
}
|