@aztec/aztec 0.0.1-commit.24de95ac → 0.0.1-commit.2606882
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 +1 -1
- package/dest/bin/index.d.ts +1 -1
- package/dest/bin/index.js +13 -6
- 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 +90 -31
- 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 +60 -53
- package/dest/cli/cli.d.ts +1 -1
- package/dest/cli/cli.js +7 -7
- 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 +166 -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/standby.d.ts +30 -0
- package/dest/cli/cmds/standby.d.ts.map +1 -0
- package/dest/cli/cmds/standby.js +97 -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 +13 -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 +79 -39
- 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 +2 -3
- 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 +8 -20
- 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 +25 -16
- 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 +21 -0
- package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -0
- package/dest/cli/cmds/utils/artifacts.js +24 -0
- package/dest/cli/cmds/utils/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 +1 -1
- package/dest/cli/preload_crs.d.ts +1 -1
- package/dest/cli/util.d.ts +12 -23
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +57 -91
- package/dest/cli/versioning.d.ts +1 -1
- package/dest/examples/token.d.ts +1 -1
- package/dest/examples/token.js +10 -10
- package/dest/examples/util.d.ts +2 -2
- package/dest/examples/util.d.ts.map +1 -1
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- 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/{sandbox → local-network}/banana_fpc.js +14 -10
- package/dest/local-network/index.d.ts +4 -0
- package/dest/local-network/index.d.ts.map +1 -0
- package/dest/{sandbox → local-network}/index.js +1 -1
- package/dest/local-network/local-network.d.ts +50 -0
- package/dest/local-network/local-network.d.ts.map +1 -0
- package/dest/local-network/local-network.js +248 -0
- package/dest/local-network/sponsored_fpc.d.ts +5 -0
- package/dest/local-network/sponsored_fpc.d.ts.map +1 -0
- package/dest/mnemonic.d.ts +1 -1
- package/dest/splash.d.ts +1 -1
- package/dest/testing/anvil_test_watcher.d.ts +26 -6
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +128 -35
- package/dest/testing/cheat_codes.d.ts +18 -17
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +72 -36
- 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 +63 -0
- package/dest/testing/index.d.ts +4 -2
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +2 -0
- package/dest/testing/token_allowed_setup.d.ts +7 -0
- package/dest/testing/token_allowed_setup.d.ts.map +1 -0
- package/dest/testing/token_allowed_setup.js +20 -0
- package/package.json +42 -37
- 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 +14 -6
- package/src/cli/admin_api_key_store.ts +128 -0
- package/src/cli/aztec_start_action.ts +83 -26
- package/src/cli/aztec_start_options.ts +68 -59
- package/src/cli/cli.ts +11 -11
- package/src/cli/cmds/compile.ts +192 -0
- package/src/cli/cmds/migrate_ha_db.ts +43 -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/standby.ts +132 -0
- package/src/cli/cmds/start_bot.ts +12 -11
- package/src/cli/cmds/start_node.ts +90 -44
- package/src/cli/cmds/start_p2p_bootstrap.ts +3 -3
- package/src/cli/cmds/start_prover_agent.ts +9 -20
- package/src/cli/cmds/start_prover_broker.ts +29 -26
- package/src/cli/cmds/start_txe.ts +7 -5
- package/src/cli/cmds/utils/artifacts.ts +44 -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 +66 -104
- package/src/examples/token.ts +11 -11
- package/src/examples/util.ts +1 -1
- package/src/index.ts +2 -2
- package/src/local-network/auth_registry.ts +19 -0
- package/src/{sandbox → local-network}/banana_fpc.ts +17 -9
- package/src/{sandbox → local-network}/index.ts +1 -1
- package/src/local-network/local-network.ts +303 -0
- package/src/{sandbox → local-network}/sponsored_fpc.ts +3 -2
- package/src/testing/anvil_test_watcher.ts +142 -33
- package/src/testing/cheat_codes.ts +92 -38
- package/src/testing/epoch_test_settler.ts +69 -0
- package/src/testing/index.ts +3 -1
- package/src/testing/token_allowed_setup.ts +19 -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 -50
- package/dest/cli/cmds/start_blob_sink.d.ts +0 -3
- package/dest/cli/cmds/start_blob_sink.d.ts.map +0 -1
- package/dest/cli/cmds/start_blob_sink.js +0 -33
- 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/sandbox/banana_fpc.d.ts +0 -10
- package/dest/sandbox/banana_fpc.d.ts.map +0 -1
- package/dest/sandbox/index.d.ts +0 -4
- package/dest/sandbox/index.d.ts.map +0 -1
- package/dest/sandbox/sandbox.d.ts +0 -74
- package/dest/sandbox/sandbox.d.ts.map +0 -1
- package/dest/sandbox/sandbox.js +0 -183
- package/dest/sandbox/sponsored_fpc.d.ts +0 -4
- package/dest/sandbox/sponsored_fpc.d.ts.map +0 -1
- package/src/cli/cmds/start_archiver.ts +0 -61
- package/src/cli/cmds/start_blob_sink.ts +0 -57
- package/src/cli/cmds/start_prover_node.ts +0 -124
- package/src/cli/release_version.ts +0 -21
- package/src/sandbox/sandbox.ts +0 -242
- /package/dest/{sandbox → local-network}/sponsored_fpc.js +0 -0
|
@@ -1,30 +1,40 @@
|
|
|
1
|
-
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
1
|
import { type AztecNodeConfig, aztecNodeConfigMappings, getConfigEnvVars } from '@aztec/aztec-node';
|
|
3
2
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
-
import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
|
|
5
3
|
import { getL1Config } from '@aztec/cli/config';
|
|
6
|
-
import { getPublicClient } from '@aztec/ethereum';
|
|
7
|
-
import {
|
|
4
|
+
import { getPublicClient } from '@aztec/ethereum/client';
|
|
5
|
+
import { getGenesisStateConfigEnvVars } from '@aztec/ethereum/config';
|
|
6
|
+
import { type NetworkNames, SecretValue } from '@aztec/foundation/config';
|
|
8
7
|
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
8
|
+
import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
|
|
9
9
|
import type { LogFn } from '@aztec/foundation/log';
|
|
10
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
11
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
12
|
+
import {
|
|
13
|
+
ProvingJobConsumerSchema,
|
|
14
|
+
createProvingJobBrokerClient,
|
|
15
|
+
proverBrokerBackoff,
|
|
16
|
+
} from '@aztec/prover-client/broker';
|
|
10
17
|
import { type CliPXEOptions, type PXEConfig, allPxeConfigMappings } from '@aztec/pxe/config';
|
|
11
18
|
import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
12
|
-
import { P2PApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
19
|
+
import { P2PApiSchema, ProverNodeApiSchema, type ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
|
|
13
20
|
import {
|
|
14
21
|
type TelemetryClientConfig,
|
|
15
22
|
initTelemetryClient,
|
|
23
|
+
makeTracedFetch,
|
|
16
24
|
telemetryClientConfigMappings,
|
|
17
25
|
} from '@aztec/telemetry-client';
|
|
18
|
-
import {
|
|
19
|
-
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
26
|
+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
20
27
|
|
|
21
|
-
import { createAztecNode } from '../../
|
|
28
|
+
import { createAztecNode } from '../../local-network/index.js';
|
|
22
29
|
import {
|
|
23
30
|
extractNamespacedOptions,
|
|
24
31
|
extractRelevantOptions,
|
|
25
32
|
preloadCrsDataForVerifying,
|
|
26
|
-
|
|
33
|
+
setupVersionChecker,
|
|
27
34
|
} from '../util.js';
|
|
35
|
+
import { getVersions } from '../versioning.js';
|
|
36
|
+
import { computeExpectedGenesisRoot, waitForCompatibleRollup } from './standby.js';
|
|
37
|
+
import { startProverBroker } from './start_prover_broker.js';
|
|
28
38
|
|
|
29
39
|
export async function startNode(
|
|
30
40
|
options: any,
|
|
@@ -32,6 +42,7 @@ export async function startNode(
|
|
|
32
42
|
services: NamespacedApiHandlers,
|
|
33
43
|
adminServices: NamespacedApiHandlers,
|
|
34
44
|
userLog: LogFn,
|
|
45
|
+
networkName: NetworkNames,
|
|
35
46
|
): Promise<{ config: AztecNodeConfig }> {
|
|
36
47
|
// All options set from environment variables
|
|
37
48
|
const configFromEnvVars = getConfigEnvVars();
|
|
@@ -45,31 +56,53 @@ export async function startNode(
|
|
|
45
56
|
...relevantOptions,
|
|
46
57
|
};
|
|
47
58
|
|
|
59
|
+
// Prover node configuration and broker setup
|
|
60
|
+
// REFACTOR: Move the broker setup out of here and into the prover-node factory
|
|
61
|
+
let broker: ProvingJobBroker | undefined = undefined;
|
|
48
62
|
if (options.proverNode) {
|
|
49
|
-
|
|
50
|
-
|
|
63
|
+
nodeConfig.enableProverNode = true;
|
|
64
|
+
if (nodeConfig.proverAgentCount === 0) {
|
|
65
|
+
userLog(
|
|
66
|
+
`Running prover node without local prover agent. Connect prover agents or pass --proverAgent.proverAgentCount`,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
if (nodeConfig.proverBrokerUrl) {
|
|
70
|
+
// at 1TPS we'd enqueue ~1k chonk verifier proofs and ~1k AVM proofs immediately
|
|
71
|
+
// set a lower connection limit such that we don't overload the server
|
|
72
|
+
// Retry indefinitely until the epoch proving times out and the chain reorgs
|
|
73
|
+
const fetch = makeTracedFetch(proverBrokerBackoff, false, makeUndiciFetch(new Agent({ connections: 100 })));
|
|
74
|
+
broker = createProvingJobBrokerClient(nodeConfig.proverBrokerUrl, getVersions(nodeConfig), fetch);
|
|
75
|
+
} else if (options.proverBroker) {
|
|
76
|
+
({ broker } = await startProverBroker(options, signalHandlers, services, userLog));
|
|
77
|
+
} else {
|
|
78
|
+
userLog(`--prover-broker-url or --prover-broker is required to start a Prover Node`);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
51
81
|
}
|
|
52
82
|
|
|
53
83
|
await preloadCrsDataForVerifying(nodeConfig, userLog);
|
|
54
84
|
|
|
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()}`);
|
|
85
|
+
const genesisConfig = getGenesisStateConfigEnvVars();
|
|
86
|
+
const { genesisArchiveRoot, genesis } = await computeExpectedGenesisRoot(genesisConfig, userLog);
|
|
64
87
|
|
|
65
88
|
const followsCanonicalRollup =
|
|
66
89
|
typeof nodeConfig.rollupVersion !== 'number' || (nodeConfig.rollupVersion as unknown as string) === 'canonical';
|
|
67
90
|
|
|
68
|
-
if (!nodeConfig.
|
|
91
|
+
if (!nodeConfig.registryAddress || nodeConfig.registryAddress.isZero()) {
|
|
69
92
|
throw new Error('L1 registry address is required to start Aztec Node');
|
|
70
93
|
}
|
|
94
|
+
|
|
95
|
+
// Wait for a compatible rollup before proceeding with full L1 config fetch.
|
|
96
|
+
// This prevents crashes when the canonical rollup hasn't been upgraded yet.
|
|
97
|
+
await waitForCompatibleRollup(
|
|
98
|
+
nodeConfig,
|
|
99
|
+
{ genesisArchiveRoot, vkTreeRoot: getVKTreeRoot(), protocolContractsHash },
|
|
100
|
+
options.port,
|
|
101
|
+
userLog,
|
|
102
|
+
);
|
|
103
|
+
|
|
71
104
|
const { addresses, config } = await getL1Config(
|
|
72
|
-
nodeConfig.
|
|
105
|
+
nodeConfig.registryAddress,
|
|
73
106
|
nodeConfig.l1RpcUrls,
|
|
74
107
|
nodeConfig.l1ChainId,
|
|
75
108
|
nodeConfig.rollupVersion,
|
|
@@ -83,17 +116,13 @@ export async function startNode(
|
|
|
83
116
|
);
|
|
84
117
|
}
|
|
85
118
|
|
|
86
|
-
// TODO(#12272): will clean this up.
|
|
87
119
|
nodeConfig = {
|
|
88
120
|
...nodeConfig,
|
|
89
|
-
|
|
90
|
-
...addresses,
|
|
91
|
-
slashFactoryAddress: nodeConfig.l1Contracts.slashFactoryAddress,
|
|
92
|
-
},
|
|
121
|
+
...addresses,
|
|
93
122
|
...config,
|
|
94
123
|
};
|
|
95
124
|
|
|
96
|
-
if (!options.sequencer) {
|
|
125
|
+
if (!options.sequencer && !nodeConfig.fishermanMode) {
|
|
97
126
|
nodeConfig.disableValidator = true;
|
|
98
127
|
} else {
|
|
99
128
|
const sequencerConfig = {
|
|
@@ -101,12 +130,17 @@ export async function startNode(
|
|
|
101
130
|
...extractNamespacedOptions(options, 'sequencer'),
|
|
102
131
|
};
|
|
103
132
|
// If no publisher private keys have been given, use the first validator key
|
|
104
|
-
if (
|
|
133
|
+
if (
|
|
134
|
+
sequencerConfig.sequencerPublisherPrivateKeys === undefined ||
|
|
135
|
+
!sequencerConfig.sequencerPublisherPrivateKeys.length
|
|
136
|
+
) {
|
|
105
137
|
if (sequencerConfig.validatorPrivateKeys?.getValue().length) {
|
|
106
|
-
sequencerConfig.
|
|
138
|
+
sequencerConfig.sequencerPublisherPrivateKeys = [
|
|
139
|
+
new SecretValue(sequencerConfig.validatorPrivateKeys.getValue()[0]),
|
|
140
|
+
];
|
|
107
141
|
}
|
|
108
142
|
}
|
|
109
|
-
nodeConfig.
|
|
143
|
+
nodeConfig.sequencerPublisherPrivateKeys = sequencerConfig.sequencerPublisherPrivateKeys;
|
|
110
144
|
}
|
|
111
145
|
|
|
112
146
|
if (nodeConfig.p2pEnabled) {
|
|
@@ -117,16 +151,25 @@ export async function startNode(
|
|
|
117
151
|
}
|
|
118
152
|
|
|
119
153
|
const telemetryConfig = extractRelevantOptions<TelemetryClientConfig>(options, telemetryClientConfigMappings, 'tel');
|
|
120
|
-
const telemetry = initTelemetryClient(telemetryConfig);
|
|
154
|
+
const telemetry = await initTelemetryClient(telemetryConfig);
|
|
121
155
|
|
|
122
156
|
// Create and start Aztec Node
|
|
123
|
-
const node = await createAztecNode(nodeConfig, { telemetry }, {
|
|
157
|
+
const node = await createAztecNode(nodeConfig, { telemetry, proverBroker: broker }, { genesis });
|
|
124
158
|
|
|
125
159
|
// Add node and p2p to services list
|
|
126
160
|
services.node = [node, AztecNodeApiSchema];
|
|
127
161
|
services.p2p = [node.getP2P(), P2PApiSchema];
|
|
128
162
|
adminServices.nodeAdmin = [node, AztecNodeAdminApiSchema];
|
|
129
163
|
|
|
164
|
+
// Register prover-node services if the prover node subsystem is running
|
|
165
|
+
const proverNode = node.getProverNode();
|
|
166
|
+
if (proverNode) {
|
|
167
|
+
services.prover = [proverNode, ProverNodeApiSchema];
|
|
168
|
+
if (!nodeConfig.proverBrokerUrl) {
|
|
169
|
+
services.provingJobSource = [proverNode.getProver().getProvingJobSource(), ProvingJobConsumerSchema];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
130
173
|
// Add node stop function to signal handlers
|
|
131
174
|
signalHandlers.push(node.stop.bind(node));
|
|
132
175
|
|
|
@@ -135,21 +178,24 @@ export async function startNode(
|
|
|
135
178
|
const { addBot } = await import('./start_bot.js');
|
|
136
179
|
|
|
137
180
|
const pxeConfig = extractRelevantOptions<PXEConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
|
|
138
|
-
const wallet = await
|
|
181
|
+
const wallet = await EmbeddedWallet.create(node, { pxeConfig });
|
|
139
182
|
|
|
140
183
|
await addBot(options, signalHandlers, services, wallet, node, telemetry, undefined);
|
|
141
184
|
}
|
|
142
185
|
|
|
143
|
-
if (nodeConfig.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
186
|
+
if (nodeConfig.enableVersionCheck && networkName !== 'local') {
|
|
187
|
+
const cacheDir = process.env.DATA_DIRECTORY ? `${process.env.DATA_DIRECTORY}/cache` : undefined;
|
|
188
|
+
try {
|
|
189
|
+
await setupVersionChecker(
|
|
190
|
+
networkName,
|
|
191
|
+
followsCanonicalRollup,
|
|
192
|
+
getPublicClient(nodeConfig!),
|
|
193
|
+
signalHandlers,
|
|
194
|
+
cacheDir,
|
|
195
|
+
);
|
|
196
|
+
} catch {
|
|
197
|
+
/* no-op */
|
|
198
|
+
}
|
|
153
199
|
}
|
|
154
200
|
|
|
155
201
|
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';
|
|
@@ -25,9 +25,9 @@ export async function startP2PBootstrap(
|
|
|
25
25
|
userLog(`Starting P2P bootstrap node with config: ${jsonStringify(safeConfig)}`);
|
|
26
26
|
|
|
27
27
|
const telemetryConfig = extractRelevantOptions<TelemetryClientConfig>(options, telemetryClientConfigMappings, 'tel');
|
|
28
|
-
const telemetryClient = initTelemetryClient(telemetryConfig);
|
|
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,28 +46,16 @@ 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
|
-
const telemetry = initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
|
|
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
|
-
() =>
|
|
62
|
-
new ProvingAgent(
|
|
63
|
-
broker,
|
|
64
|
-
proofStore,
|
|
65
|
-
prover,
|
|
66
|
-
config.proverAgentProofTypes,
|
|
67
|
-
config.proverAgentPollIntervalMs,
|
|
68
|
-
telemetry,
|
|
69
|
-
),
|
|
58
|
+
() => new ProvingAgent(broker, proofStore, prover, config.proverAgentProofTypes, config.proverAgentPollIntervalMs),
|
|
70
59
|
);
|
|
71
60
|
|
|
72
61
|
// expose all agents as individual services
|
|
@@ -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
|
-
const client = initTelemetryClient(getTelemetryClientConfig());
|
|
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,44 @@
|
|
|
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
|
+
|
|
11
|
+
export interface ContractFunction {
|
|
12
|
+
name: string;
|
|
13
|
+
abi: unknown;
|
|
14
|
+
bytecode: string;
|
|
15
|
+
debug_symbols: unknown;
|
|
16
|
+
is_unconstrained?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ArtifactFile {
|
|
20
|
+
name: string;
|
|
21
|
+
filePath: string;
|
|
22
|
+
content: CompiledArtifact;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Reads all JSON artifact files from a target directory and returns their parsed contents. */
|
|
26
|
+
export async function readArtifactFiles(targetDir: string): Promise<ArtifactFile[]> {
|
|
27
|
+
let entries: string[];
|
|
28
|
+
try {
|
|
29
|
+
entries = (await readdir(targetDir)).filter(f => f.endsWith('.json'));
|
|
30
|
+
} catch (err: any) {
|
|
31
|
+
if (err?.code === 'ENOENT') {
|
|
32
|
+
throw new Error(`Target directory '${targetDir}' does not exist. Compile first with 'aztec compile'.`);
|
|
33
|
+
}
|
|
34
|
+
throw err;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const artifacts: ArtifactFile[] = [];
|
|
38
|
+
for (const file of entries) {
|
|
39
|
+
const filePath = join(targetDir, file);
|
|
40
|
+
const content = JSON.parse(await readFile(filePath, 'utf-8')) as CompiledArtifact;
|
|
41
|
+
artifacts.push({ name: file.replace('.json', ''), filePath, content });
|
|
42
|
+
}
|
|
43
|
+
return artifacts;
|
|
44
|
+
}
|
|
@@ -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
|
+
}
|