@aztec/aztec 0.0.1-commit.f504929 → 0.0.1-commit.f81dbcf
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 +2 -2
- 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 +11 -6
- package/dest/cli/aztec_start_options.d.ts +1 -1
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +1 -2
- package/dest/cli/cli.js +3 -3
- package/dest/cli/cmds/compile.d.ts +1 -1
- package/dest/cli/cmds/compile.d.ts.map +1 -1
- package/dest/cli/cmds/compile.js +0 -92
- package/dest/cli/cmds/standby.d.ts +32 -0
- package/dest/cli/cmds/standby.d.ts.map +1 -0
- package/dest/cli/cmds/standby.js +97 -0
- package/dest/cli/cmds/start_node.d.ts +3 -2
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +19 -71
- package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
- package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_broker.js +12 -6
- package/dest/cli/util.d.ts +3 -5
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +40 -81
- package/dest/local-network/local-network.d.ts +1 -1
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +9 -1
- package/dest/testing/epoch_test_settler.d.ts +1 -1
- package/dest/testing/epoch_test_settler.d.ts.map +1 -1
- package/dest/testing/epoch_test_settler.js +3 -4
- package/dest/testing/index.d.ts +2 -1
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +1 -0
- package/dest/testing/token_allowed_setup.d.ts +7 -0
- package/dest/testing/token_allowed_setup.d.ts.map +1 -0
- package/dest/testing/token_allowed_setup.js +20 -0
- package/package.json +34 -34
- package/scripts/aztec.sh +2 -1
- package/scripts/init.sh +19 -23
- package/scripts/new.sh +24 -48
- package/scripts/setup_project.sh +31 -0
- package/src/bin/index.ts +2 -2
- package/src/cli/aztec_start_action.ts +9 -6
- package/src/cli/aztec_start_options.ts +1 -2
- package/src/cli/cli.ts +3 -3
- package/src/cli/cmds/compile.ts +0 -104
- package/src/cli/cmds/standby.ts +132 -0
- package/src/cli/cmds/start_node.ts +24 -102
- package/src/cli/cmds/start_prover_broker.ts +14 -14
- package/src/cli/util.ts +43 -76
- package/src/local-network/local-network.ts +6 -0
- package/src/testing/epoch_test_settler.ts +3 -4
- package/src/testing/index.ts +1 -0
- package/src/testing/token_allowed_setup.ts +19 -0
- package/dest/cli/release_version.d.ts +0 -2
- package/dest/cli/release_version.d.ts.map +0 -1
- package/dest/cli/release_version.js +0 -14
- package/scripts/add_crate.sh +0 -102
- package/scripts/setup_workspace.sh +0 -68
- package/src/cli/release_version.ts +0 -21
package/dest/bin/index.js
CHANGED
|
@@ -11,12 +11,12 @@ import { injectCommands as injectMiscCommands } from '@aztec/cli/misc';
|
|
|
11
11
|
import { injectCommands as injectValidatorKeysCommands } from '@aztec/cli/validator_keys';
|
|
12
12
|
import { getActiveNetworkName } from '@aztec/foundation/config';
|
|
13
13
|
import { createConsoleLogger, createLogger } from '@aztec/foundation/log';
|
|
14
|
+
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
14
15
|
import { Command } from 'commander';
|
|
15
16
|
import { injectCompileCommand } from '../cli/cmds/compile.js';
|
|
16
17
|
import { injectMigrateCommand } from '../cli/cmds/migrate_ha_db.js';
|
|
17
18
|
import { injectProfileCommand } from '../cli/cmds/profile.js';
|
|
18
19
|
import { injectAztecCommands } from '../cli/index.js';
|
|
19
|
-
import { getCliVersion } from '../cli/release_version.js';
|
|
20
20
|
const NETWORK_FLAG = 'network';
|
|
21
21
|
const userLog = createConsoleLogger();
|
|
22
22
|
const debugLogger = createLogger('cli');
|
|
@@ -36,7 +36,7 @@ const debugLogger = createLogger('cli');
|
|
|
36
36
|
const networkName = getActiveNetworkName(networkValue);
|
|
37
37
|
await enrichEnvironmentWithNetworkConfig(networkName);
|
|
38
38
|
enrichEnvironmentWithChainName(networkName);
|
|
39
|
-
const cliVersion =
|
|
39
|
+
const cliVersion = getPackageVersion() ?? 'unknown';
|
|
40
40
|
let program = new Command('aztec');
|
|
41
41
|
program.description('Aztec command line interface').version(cliVersion).enablePositionalOptions();
|
|
42
42
|
program = injectAztecCommands(program, userLog, debugLogger);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
2
|
export declare function aztecStart(options: any, userLog: LogFn, debugLogger: Logger): Promise<void>;
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXp0ZWNfc3RhcnRfYWN0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL2F6dGVjX3N0YXJ0X2FjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFhM0Qsd0JBQXNCLFVBQVUsQ0FBQyxPQUFPLEVBQUUsR0FBRyxFQUFFLE9BQU8sRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0saUJBMElqRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aztec_start_action.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aztec_start_action.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_action.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAa3D,wBAAsB,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBA0IjF"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { getActiveNetworkName } from '@aztec/foundation/config';
|
|
1
2
|
import { createNamespacedSafeJsonRpcServer, getApiKeyAuthMiddleware, startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
2
3
|
import { AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
4
|
+
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
3
5
|
import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
|
|
4
6
|
import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
|
|
5
7
|
import { createLocalNetwork } from '../local-network/index.js';
|
|
6
8
|
import { github, splash } from '../splash.js';
|
|
7
9
|
import { resolveAdminApiKey } from './admin_api_key_store.js';
|
|
8
|
-
import { getCliVersion } from './release_version.js';
|
|
9
10
|
import { extractNamespacedOptions, installSignalHandlers } from './util.js';
|
|
10
11
|
import { getVersions } from './versioning.js';
|
|
11
12
|
export async function aztecStart(options, userLog, debugLogger) {
|
|
@@ -13,13 +14,13 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
13
14
|
const signalHandlers = [];
|
|
14
15
|
const services = {};
|
|
15
16
|
const adminServices = {};
|
|
17
|
+
const packageVersion = getPackageVersion();
|
|
16
18
|
let config = undefined;
|
|
17
19
|
if (options.localNetwork) {
|
|
18
|
-
const cliVersion = getCliVersion();
|
|
19
20
|
const localNetwork = extractNamespacedOptions(options, 'local-network');
|
|
20
21
|
localNetwork.testAccounts = true;
|
|
21
22
|
userLog(`${splash}\n${github}\n\n`);
|
|
22
|
-
userLog(`Setting up Aztec local network ${
|
|
23
|
+
userLog(`Setting up Aztec local network ${packageVersion ?? 'unknown'}, please stand by...`);
|
|
23
24
|
const { node, stop } = await createLocalNetwork({
|
|
24
25
|
l1Mnemonic: localNetwork.l1Mnemonic,
|
|
25
26
|
l1RpcUrls: options.l1RpcUrls,
|
|
@@ -44,7 +45,8 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
44
45
|
}
|
|
45
46
|
if (options.node) {
|
|
46
47
|
const { startNode } = await import('./cmds/start_node.js');
|
|
47
|
-
|
|
48
|
+
const networkName = getActiveNetworkName(options.network);
|
|
49
|
+
({ config } = await startNode(options, signalHandlers, services, adminServices, userLog, networkName));
|
|
48
50
|
} else if (options.bot) {
|
|
49
51
|
const { startBot } = await import('./cmds/start_bot.js');
|
|
50
52
|
await startBot(options, signalHandlers, services, userLog);
|
|
@@ -73,6 +75,9 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
73
75
|
}
|
|
74
76
|
installSignalHandlers(debugLogger.info, signalHandlers);
|
|
75
77
|
const versions = getVersions(config);
|
|
78
|
+
const versioningOpts = {
|
|
79
|
+
packageVersion
|
|
80
|
+
};
|
|
76
81
|
// Start the main JSON-RPC server
|
|
77
82
|
if (Object.entries(services).length > 0) {
|
|
78
83
|
const rpcServer = createNamespacedSafeJsonRpcServer(services, {
|
|
@@ -80,7 +85,7 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
80
85
|
log: debugLogger,
|
|
81
86
|
middlewares: [
|
|
82
87
|
getOtelJsonRpcPropagationMiddleware(),
|
|
83
|
-
getVersioningMiddleware(versions)
|
|
88
|
+
getVersioningMiddleware(versions, versioningOpts)
|
|
84
89
|
],
|
|
85
90
|
maxBatchSize: options.rpcMaxBatchSize,
|
|
86
91
|
maxBodySizeBytes: options.rpcMaxBodySize
|
|
@@ -94,7 +99,7 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
94
99
|
if (Object.entries(adminServices).length > 0) {
|
|
95
100
|
const adminMiddlewares = [
|
|
96
101
|
getOtelJsonRpcPropagationMiddleware(),
|
|
97
|
-
getVersioningMiddleware(versions)
|
|
102
|
+
getVersioningMiddleware(versions, versioningOpts)
|
|
98
103
|
];
|
|
99
104
|
// Resolve the admin API key (auto-generated and persisted, or opt-out)
|
|
100
105
|
const apiKeyResolution = await resolveAdminApiKey({
|
|
@@ -14,4 +14,4 @@ export declare const NETWORK_FLAG = "network";
|
|
|
14
14
|
export declare const aztecStartOptions: {
|
|
15
15
|
[key: string]: AztecStartOption[];
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXp0ZWNfc3RhcnRfb3B0aW9ucy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS9henRlY19zdGFydF9vcHRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9BLE9BQU8sRUFDTCxLQUFLLGFBQWEsRUFDbEIsS0FBSyxNQUFNLEVBSVosTUFBTSwwQkFBMEIsQ0FBQztBQWVsQyxNQUFNLFdBQVcsZ0JBQWdCO0lBQy9CLElBQUksRUFBRSxNQUFNLENBQUM7SUFDYixXQUFXLEVBQUUsTUFBTSxDQUFDO0lBQ3BCLFlBQVksRUFBRSxHQUFHLENBQUM7SUFDbEIsWUFBWSxDQUFDLEVBQUUsQ0FBQyxHQUFHLEVBQUUsR0FBRyxLQUFLLE1BQU0sQ0FBQztJQUNwQyxHQUFHLEVBQUUsTUFBTSxHQUFHLFNBQVMsQ0FBQztJQUN4QixRQUFRLENBQUMsRUFBRSxNQUFNLEVBQUUsQ0FBQztJQUNwQixRQUFRLENBQUMsRUFBRSxDQUFDLEdBQUcsRUFBRSxNQUFNLEtBQUssR0FBRyxDQUFDO0NBQ2pDO0FBRUQsZUFBTyxNQUFNLFVBQVUsMEZBb0J0QixDQUFDO0FBdUJGLGVBQU8sTUFBTSxnQkFBZ0IsVUFZNUIsQ0FBQztBQUVGLGVBQU8sTUFBTSxZQUFZLFlBQVksQ0FBQztBQUd0QyxlQUFPLE1BQU0saUJBQWlCLEVBQUU7SUFBRSxDQUFDLEdBQUcsRUFBRSxNQUFNLEdBQUcsZ0JBQWdCLEVBQUUsQ0FBQTtDQXNPbEUsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aztec_start_options.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_options.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,MAAM,EAIZ,MAAM,0BAA0B,CAAC;AAelC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,GAAG,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IACpC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;CACjC;AAED,eAAO,MAAM,UAAU,0FAoBtB,CAAC;AAuBF,eAAO,MAAM,gBAAgB,UAY5B,CAAC;AAEF,eAAO,MAAM,YAAY,YAAY,CAAC;AAGtC,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"aztec_start_options.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_options.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,MAAM,EAIZ,MAAM,0BAA0B,CAAC;AAelC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,GAAG,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IACpC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;CACjC;AAED,eAAO,MAAM,UAAU,0FAoBtB,CAAC;AAuBF,eAAO,MAAM,gBAAgB,UAY5B,CAAC;AAEF,eAAO,MAAM,YAAY,YAAY,CAAC;AAGtC,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;CAsOlE,CAAC"}
|
|
@@ -76,8 +76,7 @@ export const aztecStartOptions = {
|
|
|
76
76
|
defaultValue: undefined,
|
|
77
77
|
env: 'NETWORK'
|
|
78
78
|
},
|
|
79
|
-
configToFlag('--
|
|
80
|
-
configToFlag('--auto-update-url', sharedNodeConfigMappings.autoUpdateUrl),
|
|
79
|
+
configToFlag('--enable-version-check', sharedNodeConfigMappings.enableVersionCheck),
|
|
81
80
|
configToFlag('--sync-mode', sharedNodeConfigMappings.syncMode),
|
|
82
81
|
configToFlag('--snapshots-urls', sharedNodeConfigMappings.snapshotsUrls),
|
|
83
82
|
configToFlag('--fisherman-mode', sharedNodeConfigMappings.fishermanMode)
|
package/dest/cli/cli.js
CHANGED
|
@@ -24,9 +24,9 @@ import { addOptions, printAztecStartHelpText } from './util.js';
|
|
|
24
24
|
program.addHelpText('after', `
|
|
25
25
|
Additional commands:
|
|
26
26
|
|
|
27
|
-
init
|
|
28
|
-
new <
|
|
29
|
-
test [options]
|
|
27
|
+
init [folder] [options] creates a new Aztec Noir project.
|
|
28
|
+
new <path> [options] creates a new Aztec Noir project in a new directory.
|
|
29
|
+
test [options] starts a TXE and runs "nargo test" using it as the oracle resolver.
|
|
30
30
|
`);
|
|
31
31
|
}
|
|
32
32
|
program.command('preload-crs').description('Preload the points data needed for proving and verifying').action(async (options)=>{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
import type { Command } from 'commander';
|
|
3
3
|
export declare function injectCompileCommand(program: Command, log: LogFn): Command;
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGlsZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL2NvbXBpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFHbkQsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBc0R6Qyx3QkFBZ0Isb0JBQW9CLENBQUMsT0FBTyxFQUFFLE9BQU8sRUFBRSxHQUFHLEVBQUUsS0FBSyxHQUFHLE9BQU8sQ0FzQjFFIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/compile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/compile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsDzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAsB1E"}
|
package/dest/cli/cmds/compile.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { execFileSync } from 'child_process';
|
|
2
2
|
import { readFile, writeFile } from 'fs/promises';
|
|
3
|
-
import { join } from 'path';
|
|
4
3
|
import { readArtifactFiles } from './utils/artifacts.js';
|
|
5
4
|
import { run } from './utils/spawn.js';
|
|
6
5
|
/** Returns paths to contract artifacts in the target directory. */ async function collectContractArtifacts() {
|
|
@@ -26,95 +25,6 @@ import { run } from './utils/spawn.js';
|
|
|
26
25
|
await writeFile(path, JSON.stringify(artifact, null, 2) + '\n');
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
|
-
/** Returns the set of package names that are contract crates in the current workspace. */ async function getContractPackageNames() {
|
|
30
|
-
const contractNames = new Set();
|
|
31
|
-
let rootToml;
|
|
32
|
-
try {
|
|
33
|
-
rootToml = await readFile('Nargo.toml', 'utf-8');
|
|
34
|
-
} catch {
|
|
35
|
-
return contractNames;
|
|
36
|
-
}
|
|
37
|
-
const membersMatch = rootToml.match(/members\s*=\s*\[([^\]]*)\]/);
|
|
38
|
-
if (membersMatch) {
|
|
39
|
-
const members = membersMatch[1].split(',').map((m)=>m.trim().replace(/^"|"$/g, '')).filter((m)=>m.length > 0);
|
|
40
|
-
for (const member of members){
|
|
41
|
-
try {
|
|
42
|
-
const memberToml = await readFile(join(member, 'Nargo.toml'), 'utf-8');
|
|
43
|
-
if (/type\s*=\s*"contract"/.test(memberToml)) {
|
|
44
|
-
const nameMatch = memberToml.match(/name\s*=\s*"([^"]+)"/);
|
|
45
|
-
if (nameMatch) {
|
|
46
|
-
contractNames.add(nameMatch[1]);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
} catch {
|
|
50
|
-
// Member directory might not exist or have no Nargo.toml; skip.
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
// Single-crate project (no workspace): check if the root Nargo.toml itself is a contract.
|
|
55
|
-
if (/type\s*=\s*"contract"/.test(rootToml)) {
|
|
56
|
-
const nameMatch = rootToml.match(/name\s*=\s*"([^"]+)"/);
|
|
57
|
-
if (nameMatch) {
|
|
58
|
-
contractNames.add(nameMatch[1]);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return contractNames;
|
|
63
|
-
}
|
|
64
|
-
/** Checks that no tests exist in contract crates and fails with a helpful message if they do. */ async function checkNoTestsInContracts(nargo, log) {
|
|
65
|
-
const contractPackages = await getContractPackageNames();
|
|
66
|
-
if (contractPackages.size === 0) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
let output;
|
|
70
|
-
try {
|
|
71
|
-
// We list tests for all the crates in the workspace
|
|
72
|
-
output = execFileSync(nargo, [
|
|
73
|
-
'test',
|
|
74
|
-
'--list-tests',
|
|
75
|
-
'--silence-warnings'
|
|
76
|
-
], {
|
|
77
|
-
encoding: 'utf-8',
|
|
78
|
-
stdio: [
|
|
79
|
-
'pipe',
|
|
80
|
-
'pipe',
|
|
81
|
-
'inherit'
|
|
82
|
-
]
|
|
83
|
-
});
|
|
84
|
-
} catch {
|
|
85
|
-
// If listing tests fails (e.g. test crate has compile errors), skip the check.
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
// The output of the `nargo test --list-tests` command is as follows:
|
|
89
|
-
// ```
|
|
90
|
-
// crate_name_1 test_name_1
|
|
91
|
-
// crate_name_2 test_name_2
|
|
92
|
-
// ...
|
|
93
|
-
// crate_name_n test_name_n
|
|
94
|
-
// ```
|
|
95
|
-
//
|
|
96
|
-
// We parse the individual lines and then we check if any contract crate appeared in the parsed output.
|
|
97
|
-
const lines = output.trim().split('\n').filter((line)=>line.length > 0);
|
|
98
|
-
const testsInContracts = [];
|
|
99
|
-
for (const line of lines){
|
|
100
|
-
const spaceIndex = line.indexOf(' ');
|
|
101
|
-
if (spaceIndex === -1) {
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
const packageName = line.substring(0, spaceIndex);
|
|
105
|
-
const testName = line.substring(spaceIndex + 1);
|
|
106
|
-
if (contractPackages.has(packageName)) {
|
|
107
|
-
testsInContracts.push({
|
|
108
|
-
packageName,
|
|
109
|
-
testName
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (testsInContracts.length > 0) {
|
|
114
|
-
const details = testsInContracts.map((t)=>` ${t.packageName}::${t.testName}`).join('\n');
|
|
115
|
-
log(`WARNING: Found tests in contract crate(s):\n${details}\n\n` + `Tests should be in a dedicated test crate, not in the contract crate.\n` + `Learn more: https://docs.aztec.network/errors/1`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
28
|
/** Compiles Aztec Noir contracts and postprocesses artifacts. */ async function compileAztecContract(nargoArgs, log) {
|
|
119
29
|
const nargo = process.env.NARGO ?? 'nargo';
|
|
120
30
|
const bb = process.env.BB ?? 'bb';
|
|
@@ -122,8 +32,6 @@ import { run } from './utils/spawn.js';
|
|
|
122
32
|
'compile',
|
|
123
33
|
...nargoArgs
|
|
124
34
|
]);
|
|
125
|
-
// Ensure contract crates contain no tests (tests belong in the test crate).
|
|
126
|
-
await checkNoTestsInContracts(nargo, log);
|
|
127
35
|
const artifacts = await collectContractArtifacts();
|
|
128
36
|
if (artifacts.length > 0) {
|
|
129
37
|
log('Postprocessing contracts...');
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/aztec.js/fields';
|
|
2
|
+
import type { GenesisStateConfig } from '@aztec/ethereum/config';
|
|
3
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
5
|
+
/**
|
|
6
|
+
* Computes the expected genesis archive root from the genesis state config.
|
|
7
|
+
* Reads test accounts and sponsored FPC addresses as specified, then computes
|
|
8
|
+
* the genesis values including the archive root and prefilled public data.
|
|
9
|
+
*/
|
|
10
|
+
export declare function computeExpectedGenesisRoot(config: GenesisStateConfig, userLog: LogFn): Promise<{
|
|
11
|
+
genesisArchiveRoot: Fr;
|
|
12
|
+
prefilledPublicData: import("@aztec/stdlib/trees").PublicDataTreeLeaf[];
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Waits until the canonical rollup's genesis archive root, VK tree root, and protocol contracts hash
|
|
16
|
+
* all match the expected local values. If the rollup is not yet compatible (e.g. during L1 contract upgrades),
|
|
17
|
+
* enters standby mode: starts a lightweight HTTP server for K8s liveness probes and polls every 60s
|
|
18
|
+
* until a compatible rollup appears.
|
|
19
|
+
*/
|
|
20
|
+
export declare function waitForCompatibleRollup(config: {
|
|
21
|
+
l1RpcUrls: string[];
|
|
22
|
+
l1ChainId: number;
|
|
23
|
+
l1Contracts: {
|
|
24
|
+
registryAddress: EthAddress;
|
|
25
|
+
};
|
|
26
|
+
rollupVersion?: number;
|
|
27
|
+
}, expected: {
|
|
28
|
+
genesisArchiveRoot: Fr;
|
|
29
|
+
vkTreeRoot: Fr;
|
|
30
|
+
protocolContractsHash: Fr;
|
|
31
|
+
}, port: number | undefined, userLog: LogFn): Promise<void>;
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhbmRieS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3N0YW5kYnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFHakQsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUVqRSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUVoRSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQVNuRDs7OztHQUlHO0FBQ0gsd0JBQXNCLDBCQUEwQixDQUFDLE1BQU0sRUFBRSxrQkFBa0IsRUFBRSxPQUFPLEVBQUUsS0FBSzs7O0dBYTFGO0FBd0JEOzs7OztHQUtHO0FBQ0gsd0JBQXNCLHVCQUF1QixDQUMzQyxNQUFNLEVBQUU7SUFDTixTQUFTLEVBQUUsTUFBTSxFQUFFLENBQUM7SUFDcEIsU0FBUyxFQUFFLE1BQU0sQ0FBQztJQUNsQixXQUFXLEVBQUU7UUFBRSxlQUFlLEVBQUUsVUFBVSxDQUFBO0tBQUUsQ0FBQztJQUM3QyxhQUFhLENBQUMsRUFBRSxNQUFNLENBQUM7Q0FDeEIsRUFDRCxRQUFRLEVBQUU7SUFBRSxrQkFBa0IsRUFBRSxFQUFFLENBQUM7SUFBQyxVQUFVLEVBQUUsRUFBRSxDQUFDO0lBQUMscUJBQXFCLEVBQUUsRUFBRSxDQUFBO0NBQUUsRUFDL0UsSUFBSSxFQUFFLE1BQU0sR0FBRyxTQUFTLEVBQ3hCLE9BQU8sRUFBRSxLQUFLLEdBQ2IsT0FBTyxDQUFDLElBQUksQ0FBQyxDQXdEZiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standby.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/standby.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AASnD;;;;GAIG;AACH,wBAAsB,0BAA0B,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,EAAE,KAAK;;;GAa1F;AAwBD;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE;IACN,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE;QAAE,eAAe,EAAE,UAAU,CAAA;KAAE,CAAC;IAC7C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,EACD,QAAQ,EAAE;IAAE,kBAAkB,EAAE,EAAE,CAAC;IAAC,UAAU,EAAE,EAAE,CAAC;IAAC,qBAAqB,EAAE,EAAE,CAAA;CAAE,EAC/E,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,KAAK,GACb,OAAO,CAAC,IAAI,CAAC,CAwDf"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
+
import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
|
|
3
|
+
import { getPublicClient } from '@aztec/ethereum/client';
|
|
4
|
+
import { RegistryContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
5
|
+
import { startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
6
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
7
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
+
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
9
|
+
import Koa from 'koa';
|
|
10
|
+
const ROLLUP_POLL_INTERVAL_S = 60;
|
|
11
|
+
/**
|
|
12
|
+
* Computes the expected genesis archive root from the genesis state config.
|
|
13
|
+
* Reads test accounts and sponsored FPC addresses as specified, then computes
|
|
14
|
+
* the genesis values including the archive root and prefilled public data.
|
|
15
|
+
*/ export async function computeExpectedGenesisRoot(config, userLog) {
|
|
16
|
+
const testAccounts = config.testAccounts ? (await getInitialTestAccountsData()).map((a)=>a.address) : [];
|
|
17
|
+
const sponsoredFPCAccounts = config.sponsoredFPC ? [
|
|
18
|
+
await getSponsoredFPCAddress()
|
|
19
|
+
] : [];
|
|
20
|
+
const prefundAddresses = (config.prefundAddresses ?? []).map((a)=>AztecAddress.fromString(a));
|
|
21
|
+
const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts).concat(prefundAddresses);
|
|
22
|
+
userLog(`Initial funded accounts: ${initialFundedAccounts.map((a)=>a.toString()).join(', ')}`);
|
|
23
|
+
const { genesisArchiveRoot, prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
|
|
24
|
+
userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
|
|
25
|
+
return {
|
|
26
|
+
genesisArchiveRoot,
|
|
27
|
+
prefilledPublicData
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
async function checkRollupCompatibility(rollup, expected) {
|
|
31
|
+
const mismatches = [];
|
|
32
|
+
const [l1Genesis, l1Vk, l1Protocol] = await Promise.all([
|
|
33
|
+
rollup.getGenesisArchiveTreeRoot(),
|
|
34
|
+
rollup.getVkTreeRoot(),
|
|
35
|
+
rollup.getProtocolContractsHash()
|
|
36
|
+
]);
|
|
37
|
+
if (!l1Genesis.equals(expected.genesisArchiveRoot)) {
|
|
38
|
+
mismatches.push(`genesis archive root (expected ${expected.genesisArchiveRoot}, got ${l1Genesis})`);
|
|
39
|
+
}
|
|
40
|
+
if (!l1Vk.equals(expected.vkTreeRoot)) {
|
|
41
|
+
mismatches.push(`VK tree root (expected ${expected.vkTreeRoot}, got ${l1Vk})`);
|
|
42
|
+
}
|
|
43
|
+
if (!l1Protocol.equals(expected.protocolContractsHash)) {
|
|
44
|
+
mismatches.push(`protocol contracts hash (expected ${expected.protocolContractsHash}, got ${l1Protocol})`);
|
|
45
|
+
}
|
|
46
|
+
return mismatches;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Waits until the canonical rollup's genesis archive root, VK tree root, and protocol contracts hash
|
|
50
|
+
* all match the expected local values. If the rollup is not yet compatible (e.g. during L1 contract upgrades),
|
|
51
|
+
* enters standby mode: starts a lightweight HTTP server for K8s liveness probes and polls every 60s
|
|
52
|
+
* until a compatible rollup appears.
|
|
53
|
+
*/ export async function waitForCompatibleRollup(config, expected, port, userLog) {
|
|
54
|
+
const publicClient = getPublicClient(config);
|
|
55
|
+
const rollupVersion = config.rollupVersion ?? 'canonical';
|
|
56
|
+
const registry = new RegistryContract(publicClient, config.l1Contracts.registryAddress);
|
|
57
|
+
const rollupAddress = await registry.getRollupAddress(rollupVersion);
|
|
58
|
+
const rollup = new RollupContract(publicClient, rollupAddress.toString());
|
|
59
|
+
let mismatches;
|
|
60
|
+
try {
|
|
61
|
+
mismatches = await checkRollupCompatibility(rollup, expected);
|
|
62
|
+
} catch (err) {
|
|
63
|
+
throw new Error(`Could not retrieve rollup config from canonical rollup at ${rollupAddress}: ${err.message}`);
|
|
64
|
+
}
|
|
65
|
+
if (mismatches.length === 0) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
userLog(`Rollup at ${rollupAddress} is incompatible: ${mismatches.join('; ')}. ` + `Entering standby mode. Will poll every ${ROLLUP_POLL_INTERVAL_S}s for a compatible rollup...`);
|
|
69
|
+
const standbyServer = await startHttpRpcServer({
|
|
70
|
+
getApp: ()=>new Koa(),
|
|
71
|
+
isHealthy: ()=>true
|
|
72
|
+
}, {
|
|
73
|
+
port
|
|
74
|
+
});
|
|
75
|
+
userLog(`Standby status server listening on port ${standbyServer.port}`);
|
|
76
|
+
try {
|
|
77
|
+
await retryUntil(async ()=>{
|
|
78
|
+
const currentRollupAddress = await registry.getRollupAddress(rollupVersion);
|
|
79
|
+
const currentRollup = new RollupContract(publicClient, currentRollupAddress.toString());
|
|
80
|
+
let currentMismatches;
|
|
81
|
+
try {
|
|
82
|
+
currentMismatches = await checkRollupCompatibility(currentRollup, expected);
|
|
83
|
+
} catch {
|
|
84
|
+
userLog(`Failed to fetch rollup config from rollup at ${currentRollupAddress}. Retrying...`);
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
if (currentMismatches.length === 0) {
|
|
88
|
+
userLog(`Compatible rollup found at ${currentRollupAddress}. Exiting standby mode.`);
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
userLog(`Still waiting. Rollup at ${currentRollupAddress}: ${currentMismatches.join('; ')}.`);
|
|
92
|
+
return undefined;
|
|
93
|
+
}, 'compatible rollup', 0, ROLLUP_POLL_INTERVAL_S);
|
|
94
|
+
} finally{
|
|
95
|
+
await new Promise((resolve, reject)=>standbyServer.close((err)=>err ? reject(err) : resolve()));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type AztecNodeConfig } from '@aztec/aztec-node';
|
|
2
|
+
import { type NetworkNames } from '@aztec/foundation/config';
|
|
2
3
|
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
3
4
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
|
-
export declare function startNode(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, adminServices: NamespacedApiHandlers, userLog: LogFn): Promise<{
|
|
5
|
+
export declare function startNode(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, adminServices: NamespacedApiHandlers, userLog: LogFn, networkName: NetworkNames): Promise<{
|
|
5
6
|
config: AztecNodeConfig;
|
|
6
7
|
}>;
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfbm9kZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3N0YXJ0X25vZGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUE2QyxNQUFNLG1CQUFtQixDQUFDO0FBS3BHLE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBZSxNQUFNLDBCQUEwQixDQUFDO0FBQzFFLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFFL0UsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUEwQm5ELHdCQUFzQixTQUFTLENBQzdCLE9BQU8sRUFBRSxHQUFHLEVBQ1osY0FBYyxFQUFFLENBQUMsTUFBTSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsRUFBRSxFQUN2QyxRQUFRLEVBQUUscUJBQXFCLEVBQy9CLGFBQWEsRUFBRSxxQkFBcUIsRUFDcEMsT0FBTyxFQUFFLEtBQUssRUFDZCxXQUFXLEVBQUUsWUFBWSxHQUN4QixPQUFPLENBQUM7SUFBRSxNQUFNLEVBQUUsZUFBZSxDQUFBO0NBQUUsQ0FBQyxDQW9LdEMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_node.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"start_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAA6C,MAAM,mBAAmB,CAAC;AAKpG,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AA0BnD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,aAAa,EAAE,qBAAqB,EACpC,OAAO,EAAE,KAAK,EACd,WAAW,EAAE,YAAY,GACxB,OAAO,CAAC;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CAoKtC"}
|
|
@@ -1,74 +1,24 @@
|
|
|
1
|
-
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
1
|
import { 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
4
|
import { getPublicClient } from '@aztec/ethereum/client';
|
|
7
|
-
import {
|
|
5
|
+
import { getGenesisStateConfigEnvVars } from '@aztec/ethereum/config';
|
|
8
6
|
import { SecretValue } from '@aztec/foundation/config';
|
|
9
|
-
import { startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
10
7
|
import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
|
|
11
|
-
import {
|
|
8
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
9
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
12
10
|
import { ProvingJobConsumerSchema, createProvingJobBrokerClient } from '@aztec/prover-client/broker';
|
|
13
11
|
import { allPxeConfigMappings } from '@aztec/pxe/config';
|
|
14
12
|
import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
15
13
|
import { P2PApiSchema, ProverNodeApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
16
14
|
import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } from '@aztec/telemetry-client';
|
|
17
15
|
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
18
|
-
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
19
|
-
import Koa from 'koa';
|
|
20
16
|
import { createAztecNode } from '../../local-network/index.js';
|
|
21
|
-
import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying,
|
|
17
|
+
import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying, setupVersionChecker } from '../util.js';
|
|
22
18
|
import { getVersions } from '../versioning.js';
|
|
19
|
+
import { computeExpectedGenesisRoot, waitForCompatibleRollup } from './standby.js';
|
|
23
20
|
import { startProverBroker } from './start_prover_broker.js';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Waits until the canonical rollup's genesis archive root matches the expected local genesis root.
|
|
27
|
-
* If the rollup is not yet compatible (e.g. during L1 contract upgrades), enters standby mode:
|
|
28
|
-
* starts a lightweight HTTP server for K8s liveness probes and polls until a compatible rollup appears.
|
|
29
|
-
*/ async function waitForCompatibleRollup(publicClient, registryAddress, rollupVersion, expectedGenesisRoot, port, userLog) {
|
|
30
|
-
const registry = new RegistryContract(publicClient, registryAddress);
|
|
31
|
-
const rollupAddress = await registry.getRollupAddress(rollupVersion);
|
|
32
|
-
const rollup = new RollupContract(publicClient, rollupAddress.toString());
|
|
33
|
-
let l1GenesisRoot;
|
|
34
|
-
try {
|
|
35
|
-
l1GenesisRoot = await rollup.getGenesisArchiveTreeRoot();
|
|
36
|
-
} catch (err) {
|
|
37
|
-
throw new Error(`Could not retrieve genesis archive root from canonical rollup at ${rollupAddress}: ${err.message}`);
|
|
38
|
-
}
|
|
39
|
-
if (l1GenesisRoot.equals(expectedGenesisRoot)) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
userLog(`Genesis root mismatch: expected ${expectedGenesisRoot}, got ${l1GenesisRoot} from rollup at ${rollupAddress}. ` + `Entering standby mode. Will poll every ${ROLLUP_POLL_INTERVAL_MS / 1000}s for a compatible rollup...`);
|
|
43
|
-
const standbyServer = await startHttpRpcServer({
|
|
44
|
-
getApp: ()=>new Koa(),
|
|
45
|
-
isHealthy: ()=>true
|
|
46
|
-
}, {
|
|
47
|
-
port
|
|
48
|
-
});
|
|
49
|
-
userLog(`Standby status server listening on port ${standbyServer.port}`);
|
|
50
|
-
try {
|
|
51
|
-
while(true){
|
|
52
|
-
await sleep(ROLLUP_POLL_INTERVAL_MS);
|
|
53
|
-
const currentRollupAddress = await registry.getRollupAddress(rollupVersion);
|
|
54
|
-
const currentRollup = new RollupContract(publicClient, currentRollupAddress.toString());
|
|
55
|
-
try {
|
|
56
|
-
l1GenesisRoot = await currentRollup.getGenesisArchiveTreeRoot();
|
|
57
|
-
} catch {
|
|
58
|
-
userLog(`Failed to fetch genesis root from rollup at ${currentRollupAddress}. Retrying...`);
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
if (l1GenesisRoot.equals(expectedGenesisRoot)) {
|
|
62
|
-
userLog(`Compatible rollup found at ${currentRollupAddress}. Exiting standby mode.`);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
userLog(`Still waiting. Rollup at ${currentRollupAddress} has genesis root ${l1GenesisRoot}.`);
|
|
66
|
-
}
|
|
67
|
-
} finally{
|
|
68
|
-
await new Promise((resolve, reject)=>standbyServer.close((err)=>err ? reject(err) : resolve()));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
export async function startNode(options, signalHandlers, services, adminServices, userLog) {
|
|
21
|
+
export async function startNode(options, signalHandlers, services, adminServices, userLog, networkName) {
|
|
72
22
|
// All options set from environment variables
|
|
73
23
|
const configFromEnvVars = getConfigEnvVars();
|
|
74
24
|
// Extract relevant options from command line arguments
|
|
@@ -114,23 +64,19 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
114
64
|
}
|
|
115
65
|
}
|
|
116
66
|
await preloadCrsDataForVerifying(nodeConfig, userLog);
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
await getSponsoredFPCAddress()
|
|
120
|
-
] : [];
|
|
121
|
-
const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts);
|
|
122
|
-
userLog(`Initial funded accounts: ${initialFundedAccounts.map((a)=>a.toString()).join(', ')}`);
|
|
123
|
-
const { genesisArchiveRoot, prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
|
|
124
|
-
userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
|
|
67
|
+
const genesisConfig = getGenesisStateConfigEnvVars();
|
|
68
|
+
const { genesisArchiveRoot, prefilledPublicData } = await computeExpectedGenesisRoot(genesisConfig, userLog);
|
|
125
69
|
const followsCanonicalRollup = typeof nodeConfig.rollupVersion !== 'number' || nodeConfig.rollupVersion === 'canonical';
|
|
126
70
|
if (!nodeConfig.l1Contracts.registryAddress || nodeConfig.l1Contracts.registryAddress.isZero()) {
|
|
127
71
|
throw new Error('L1 registry address is required to start Aztec Node');
|
|
128
72
|
}
|
|
129
73
|
// Wait for a compatible rollup before proceeding with full L1 config fetch.
|
|
130
74
|
// This prevents crashes when the canonical rollup hasn't been upgraded yet.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
75
|
+
await waitForCompatibleRollup(nodeConfig, {
|
|
76
|
+
genesisArchiveRoot,
|
|
77
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
78
|
+
protocolContractsHash
|
|
79
|
+
}, options.port, userLog);
|
|
134
80
|
const { addresses, config } = await getL1Config(nodeConfig.l1Contracts.registryAddress, nodeConfig.l1RpcUrls, nodeConfig.l1ChainId, nodeConfig.rollupVersion);
|
|
135
81
|
process.env.ROLLUP_CONTRACT_ADDRESS ??= addresses.rollupAddress.toString();
|
|
136
82
|
if (!Fr.fromHexString(config.genesisArchiveTreeRoot).equals(genesisArchiveRoot)) {
|
|
@@ -215,10 +161,12 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
215
161
|
});
|
|
216
162
|
await addBot(options, signalHandlers, services, wallet, node, telemetry, undefined);
|
|
217
163
|
}
|
|
218
|
-
if (nodeConfig.
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
164
|
+
if (nodeConfig.enableVersionCheck && networkName !== 'local') {
|
|
165
|
+
const cacheDir = process.env.DATA_DIRECTORY ? `${process.env.DATA_DIRECTORY}/cache` : undefined;
|
|
166
|
+
try {
|
|
167
|
+
await setupVersionChecker(networkName, followsCanonicalRollup, getPublicClient(nodeConfig), signalHandlers, cacheDir);
|
|
168
|
+
} catch {
|
|
169
|
+
/* no-op */ }
|
|
222
170
|
}
|
|
223
171
|
return {
|
|
224
172
|
config: nodeConfig
|
|
@@ -6,4 +6,4 @@ export declare function startProverBroker(options: any, signalHandlers: (() => P
|
|
|
6
6
|
broker: ProvingJobBroker;
|
|
7
7
|
config: ProverBrokerConfig;
|
|
8
8
|
}>;
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfcHJvdmVyX2Jyb2tlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3N0YXJ0X3Byb3Zlcl9icm9rZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUMvRSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUduRCxPQUFPLEVBQ0wsS0FBSyxrQkFBa0IsRUFLeEIsTUFBTSw2QkFBNkIsQ0FBQztBQUVyQyxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBTXhFLHdCQUFzQixpQkFBaUIsQ0FDckMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsRUFDL0IsT0FBTyxFQUFFLEtBQUssR0FDYixPQUFPLENBQUM7SUFBRSxNQUFNLEVBQUUsZ0JBQWdCLENBQUM7SUFBQyxNQUFNLEVBQUUsa0JBQWtCLENBQUE7Q0FBRSxDQUFDLENBNENuRSJ9
|
|
@@ -1 +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,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
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,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAMxE,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,CA4CnE"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { getL1Config } from '@aztec/cli/config';
|
|
2
|
-
import {
|
|
2
|
+
import { getGenesisStateConfigEnvVars } from '@aztec/ethereum/config';
|
|
3
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
4
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
3
5
|
import { ProvingJobBrokerSchema, ProvingJobBrokerSchemaWithDebug, createAndStartProvingBroker, proverBrokerConfigMappings } from '@aztec/prover-client/broker';
|
|
4
6
|
import { getProverNodeBrokerConfigFromEnv } from '@aztec/prover-node';
|
|
5
7
|
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
6
|
-
import { extractRelevantOptions
|
|
8
|
+
import { extractRelevantOptions } from '../util.js';
|
|
9
|
+
import { computeExpectedGenesisRoot, waitForCompatibleRollup } from './standby.js';
|
|
7
10
|
export async function startProverBroker(options, signalHandlers, services, userLog) {
|
|
8
11
|
if (options.node || options.sequencer || options.pxe || options.p2pBootstrap || options.txe) {
|
|
9
12
|
userLog(`Starting a prover broker with --node, --sequencer, --pxe, --p2p-bootstrap, or --txe is not supported.`);
|
|
@@ -16,15 +19,18 @@ export async function startProverBroker(options, signalHandlers, services, userL
|
|
|
16
19
|
if (!config.l1Contracts.registryAddress || config.l1Contracts.registryAddress.isZero()) {
|
|
17
20
|
throw new Error('L1 registry address is required to start Aztec Node without --deploy-aztec-contracts option');
|
|
18
21
|
}
|
|
19
|
-
const
|
|
22
|
+
const genesisConfig = getGenesisStateConfigEnvVars();
|
|
23
|
+
const { genesisArchiveRoot } = await computeExpectedGenesisRoot(genesisConfig, userLog);
|
|
24
|
+
await waitForCompatibleRollup(config, {
|
|
25
|
+
genesisArchiveRoot,
|
|
26
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
27
|
+
protocolContractsHash
|
|
28
|
+
}, options.port, userLog);
|
|
20
29
|
const { addresses, config: rollupConfig } = await getL1Config(config.l1Contracts.registryAddress, config.l1RpcUrls, config.l1ChainId, config.rollupVersion);
|
|
21
30
|
config.l1Contracts = addresses;
|
|
22
31
|
config.rollupVersion = rollupConfig.rollupVersion;
|
|
23
32
|
const client = await initTelemetryClient(getTelemetryClientConfig());
|
|
24
33
|
const broker = await createAndStartProvingBroker(config, client);
|
|
25
|
-
if (options.autoUpdate !== 'disabled' && options.autoUpdateUrl) {
|
|
26
|
-
await setupUpdateMonitor(options.autoUpdate, new URL(options.autoUpdateUrl), followsCanonicalRollup, getPublicClient(config), config.l1Contracts.registryAddress, signalHandlers);
|
|
27
|
-
}
|
|
28
34
|
services.proverBroker = [
|
|
29
35
|
broker,
|
|
30
36
|
config.proverBrokerDebugReplayEnabled ? ProvingJobBrokerSchemaWithDebug : ProvingJobBrokerSchema
|