@aztec/aztec 0.0.1-commit.7b97ef96e → 0.0.1-commit.7cbc774
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 +4 -2
- package/dest/cli/admin_api_key_store.d.ts +3 -3
- package/dest/cli/admin_api_key_store.d.ts.map +1 -1
- package/dest/cli/admin_api_key_store.js +3 -3
- 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 +33 -16
- 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 +20 -20
- 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 +114 -43
- 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 +1 -1
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +3 -3
- 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 +28 -40
- 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 +5 -17
- 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 +22 -13
- 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/util.d.ts +3 -5
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +46 -85
- package/dest/examples/token.js +4 -4
- package/dest/local-network/auth_registry.d.ts +4 -0
- package/dest/local-network/auth_registry.d.ts.map +1 -0
- package/dest/local-network/auth_registry.js +15 -0
- package/dest/local-network/banana_fpc.d.ts +1 -1
- package/dest/local-network/banana_fpc.d.ts.map +1 -1
- package/dest/local-network/banana_fpc.js +9 -7
- package/dest/local-network/local-network.d.ts +5 -28
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +44 -17
- package/dest/testing/anvil_test_watcher.d.ts +15 -3
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +68 -14
- 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 +1 -1
- package/dest/testing/epoch_test_settler.d.ts.map +1 -1
- package/dest/testing/epoch_test_settler.js +9 -8
- package/dest/testing/index.d.ts +3 -2
- 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 +35 -34
- package/scripts/add_crate.sh +53 -0
- package/scripts/aztec.sh +15 -4
- 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 +4 -2
- package/src/cli/admin_api_key_store.ts +4 -4
- package/src/cli/aztec_start_action.ts +22 -16
- package/src/cli/aztec_start_options.ts +27 -28
- package/src/cli/cli.ts +3 -3
- package/src/cli/cmds/compile.ts +129 -44
- 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 +3 -5
- package/src/cli/cmds/start_node.ts +43 -39
- package/src/cli/cmds/start_prover_agent.ts +5 -8
- package/src/cli/cmds/start_prover_broker.ts +23 -24
- 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 +49 -82
- package/src/examples/token.ts +6 -4
- package/src/local-network/auth_registry.ts +14 -0
- package/src/local-network/banana_fpc.ts +5 -8
- package/src/local-network/local-network.ts +43 -14
- package/src/testing/anvil_test_watcher.ts +76 -13
- package/src/testing/cheat_codes.ts +92 -39
- package/src/testing/epoch_test_settler.ts +6 -8
- package/src/testing/index.ts +2 -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 -48
- 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/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/release_version.ts +0 -21
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { findBbBinary } from '@aztec/bb.js';
|
|
2
|
+
import { readFile, rename, rm, writeFile } from 'fs/promises';
|
|
3
|
+
import { basename, dirname, join } from 'path';
|
|
4
|
+
import { makeFunctionArtifact } from './profile_utils.js';
|
|
5
|
+
import { run } from './utils/spawn.js';
|
|
6
|
+
/** Generates a gate count flamegraph SVG for a single contract function. */ export async function profileFlamegraph(artifactPath, functionName, log) {
|
|
7
|
+
const raw = await readFile(artifactPath, 'utf-8');
|
|
8
|
+
const artifact = JSON.parse(raw);
|
|
9
|
+
if (!Array.isArray(artifact.functions)) {
|
|
10
|
+
throw new Error(`${artifactPath} does not appear to be a contract artifact (no functions array)`);
|
|
11
|
+
}
|
|
12
|
+
const func = artifact.functions.find((f)=>f.name === functionName);
|
|
13
|
+
if (!func) {
|
|
14
|
+
const available = artifact.functions.map((f)=>f.name).join(', ');
|
|
15
|
+
throw new Error(`Function "${functionName}" not found in artifact. Available: ${available}`);
|
|
16
|
+
}
|
|
17
|
+
if (func.is_unconstrained) {
|
|
18
|
+
throw new Error(`Function "${functionName}" is unconstrained and cannot be profiled`);
|
|
19
|
+
}
|
|
20
|
+
const outputDir = dirname(artifactPath);
|
|
21
|
+
const contractName = basename(artifactPath, '.json');
|
|
22
|
+
const functionArtifact = join(outputDir, `${contractName}-${functionName}.json`);
|
|
23
|
+
try {
|
|
24
|
+
await writeFile(functionArtifact, makeFunctionArtifact(artifact, func));
|
|
25
|
+
const profiler = process.env.PROFILER_PATH ?? 'noir-profiler';
|
|
26
|
+
const bb = process.env.BB ?? findBbBinary() ?? 'bb';
|
|
27
|
+
await run(profiler, [
|
|
28
|
+
'gates',
|
|
29
|
+
'--artifact-path',
|
|
30
|
+
functionArtifact,
|
|
31
|
+
'--backend-path',
|
|
32
|
+
bb,
|
|
33
|
+
'--backend-gates-command',
|
|
34
|
+
'gates',
|
|
35
|
+
'--output',
|
|
36
|
+
outputDir,
|
|
37
|
+
'--scheme',
|
|
38
|
+
'chonk',
|
|
39
|
+
'--include_gates_per_opcode'
|
|
40
|
+
]);
|
|
41
|
+
// noir-profiler names the SVG using the internal function name which
|
|
42
|
+
// retains the __aztec_nr_internals__ prefix in the bytecode metadata.
|
|
43
|
+
const srcSvg = join(outputDir, `__aztec_nr_internals__${functionName}_gates.svg`);
|
|
44
|
+
const destSvg = join(outputDir, `${contractName}-${functionName}-flamegraph.svg`);
|
|
45
|
+
await rename(srcSvg, destSvg);
|
|
46
|
+
log(`Flamegraph written to ${destSvg}`);
|
|
47
|
+
} finally{
|
|
48
|
+
await rm(functionArtifact, {
|
|
49
|
+
force: true
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
+
/** Profiles all compiled artifacts in a target directory and prints gate counts. */
|
|
3
|
+
export declare function profileGates(targetDir: string, json: boolean, log: LogFn): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZV9nYXRlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3Byb2ZpbGVfZ2F0ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFnQ25ELG9GQUFvRjtBQUNwRix3QkFBc0IsWUFBWSxDQUFDLFNBQVMsRUFBRSxNQUFNLEVBQUUsSUFBSSxFQUFFLE9BQU8sRUFBRSxHQUFHLEVBQUUsS0FBSyxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FnRDlGIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile_gates.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile_gates.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAgCnD,oFAAoF;AACpF,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAgD9F"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { findBbBinary } from '@aztec/bb.js';
|
|
2
|
+
import { asyncPool } from '@aztec/foundation/async-pool';
|
|
3
|
+
import { execFile as execFileCb } from 'child_process';
|
|
4
|
+
import { rm } from 'fs/promises';
|
|
5
|
+
import { promisify } from 'util';
|
|
6
|
+
import { MAX_CONCURRENT, discoverArtifacts } from './profile_utils.js';
|
|
7
|
+
const execFile = promisify(execFileCb);
|
|
8
|
+
/** Parses circuit_size from bb gates JSON output: { "functions": [{ "circuit_size": N }] } */ function parseGateCount(stdout) {
|
|
9
|
+
const parsed = JSON.parse(stdout);
|
|
10
|
+
const size = parsed?.functions?.[0]?.circuit_size;
|
|
11
|
+
if (typeof size !== 'number') {
|
|
12
|
+
throw new Error('Failed to parse circuit_size from bb gates output');
|
|
13
|
+
}
|
|
14
|
+
return size;
|
|
15
|
+
}
|
|
16
|
+
/** Runs bb gates on a single artifact file and returns the gate count. */ async function getGateCount(bb, artifactPath) {
|
|
17
|
+
const { stdout } = await execFile(bb, [
|
|
18
|
+
'gates',
|
|
19
|
+
'--scheme',
|
|
20
|
+
'chonk',
|
|
21
|
+
'-b',
|
|
22
|
+
artifactPath
|
|
23
|
+
]);
|
|
24
|
+
return parseGateCount(stdout);
|
|
25
|
+
}
|
|
26
|
+
/** Profiles all compiled artifacts in a target directory and prints gate counts. */ export async function profileGates(targetDir, json, log) {
|
|
27
|
+
const bb = process.env.BB ?? findBbBinary() ?? 'bb';
|
|
28
|
+
const { artifacts, tmpDir } = await discoverArtifacts(targetDir);
|
|
29
|
+
if (artifacts.length === 0) {
|
|
30
|
+
if (json) {
|
|
31
|
+
log('[]');
|
|
32
|
+
} else {
|
|
33
|
+
log('No artifacts found in target directory.');
|
|
34
|
+
}
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const results = await asyncPool(MAX_CONCURRENT, artifacts, async (artifact)=>({
|
|
39
|
+
name: artifact.name,
|
|
40
|
+
type: artifact.type,
|
|
41
|
+
gateCount: await getGateCount(bb, artifact.filePath)
|
|
42
|
+
}));
|
|
43
|
+
results.sort((a, b)=>a.name.localeCompare(b.name));
|
|
44
|
+
if (results.length === 0) {
|
|
45
|
+
if (json) {
|
|
46
|
+
log('[]');
|
|
47
|
+
} else {
|
|
48
|
+
log('No constrained circuits found.');
|
|
49
|
+
}
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (json) {
|
|
53
|
+
const entries = results.map((r)=>({
|
|
54
|
+
name: r.name,
|
|
55
|
+
type: r.type,
|
|
56
|
+
gates: r.gateCount
|
|
57
|
+
}));
|
|
58
|
+
log(JSON.stringify(entries, null, 2));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const maxNameLen = Math.max(...results.map((r)=>r.name.length));
|
|
62
|
+
log('');
|
|
63
|
+
log('Gate counts:');
|
|
64
|
+
log('-'.repeat(maxNameLen + 16));
|
|
65
|
+
for (const { name, gateCount } of results){
|
|
66
|
+
log(`${name.padEnd(maxNameLen)} ${gateCount.toLocaleString().padStart(12)}`);
|
|
67
|
+
}
|
|
68
|
+
log('-'.repeat(maxNameLen + 16));
|
|
69
|
+
log(`Total: ${results.length} circuit(s)`);
|
|
70
|
+
} finally{
|
|
71
|
+
await rm(tmpDir, {
|
|
72
|
+
recursive: true,
|
|
73
|
+
force: true
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CompiledArtifact, ContractFunction } from './utils/artifacts.js';
|
|
2
|
+
export declare const MAX_CONCURRENT = 4;
|
|
3
|
+
export interface DiscoveredArtifact {
|
|
4
|
+
name: string;
|
|
5
|
+
filePath: string;
|
|
6
|
+
type: 'contract-function' | 'program';
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Reads a target directory and returns a list of discovered artifacts with temp files
|
|
10
|
+
* created for contract functions. Caller must clean up tmpDir when done.
|
|
11
|
+
*/
|
|
12
|
+
export declare function discoverArtifacts(targetDir: string): Promise<{
|
|
13
|
+
artifacts: DiscoveredArtifact[];
|
|
14
|
+
tmpDir: string;
|
|
15
|
+
}>;
|
|
16
|
+
/** Extracts a contract function as a standalone program artifact JSON string. */
|
|
17
|
+
export declare function makeFunctionArtifact(artifact: CompiledArtifact, func: ContractFunction): string;
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZV91dGlscy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3Byb2ZpbGVfdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUcvRSxlQUFPLE1BQU0sY0FBYyxJQUFJLENBQUM7QUFFaEMsTUFBTSxXQUFXLGtCQUFrQjtJQUNqQyxJQUFJLEVBQUUsTUFBTSxDQUFDO0lBQ2IsUUFBUSxFQUFFLE1BQU0sQ0FBQztJQUNqQixJQUFJLEVBQUUsbUJBQW1CLEdBQUcsU0FBUyxDQUFDO0NBQ3ZDO0FBRUQ7OztHQUdHO0FBQ0gsd0JBQXNCLGlCQUFpQixDQUNyQyxTQUFTLEVBQUUsTUFBTSxHQUNoQixPQUFPLENBQUM7SUFBRSxTQUFTLEVBQUUsa0JBQWtCLEVBQUUsQ0FBQztJQUFDLE1BQU0sRUFBRSxNQUFNLENBQUE7Q0FBRSxDQUFDLENBc0I5RDtBQUVELGlGQUFpRjtBQUNqRix3QkFBZ0Isb0JBQW9CLENBQUMsUUFBUSxFQUFFLGdCQUFnQixFQUFFLElBQUksRUFBRSxnQkFBZ0IsVUFXdEYifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile_utils.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile_utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG/E,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,mBAAmB,GAAG,SAAS,CAAC;CACvC;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAsB9D;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,gBAAgB,UAWtF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { mkdtemp, writeFile } from 'fs/promises';
|
|
2
|
+
import { tmpdir } from 'os';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { readArtifactFiles } from './utils/artifacts.js';
|
|
5
|
+
export const MAX_CONCURRENT = 4;
|
|
6
|
+
/**
|
|
7
|
+
* Reads a target directory and returns a list of discovered artifacts with temp files
|
|
8
|
+
* created for contract functions. Caller must clean up tmpDir when done.
|
|
9
|
+
*/ export async function discoverArtifacts(targetDir) {
|
|
10
|
+
const files = await readArtifactFiles(targetDir);
|
|
11
|
+
const tmpDir = await mkdtemp(join(tmpdir(), 'aztec-profile-'));
|
|
12
|
+
const artifacts = [];
|
|
13
|
+
for (const file of files){
|
|
14
|
+
if (Array.isArray(file.content.functions)) {
|
|
15
|
+
for (const func of file.content.functions){
|
|
16
|
+
if (!func.bytecode || func.is_unconstrained) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const name = `${file.name}::${func.name}`;
|
|
20
|
+
const tmpPath = join(tmpDir, `${file.name}-${func.name}.json`);
|
|
21
|
+
await writeFile(tmpPath, makeFunctionArtifact(file.content, func));
|
|
22
|
+
artifacts.push({
|
|
23
|
+
name,
|
|
24
|
+
filePath: tmpPath,
|
|
25
|
+
type: 'contract-function'
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
} else if (file.content.bytecode) {
|
|
29
|
+
artifacts.push({
|
|
30
|
+
name: file.name,
|
|
31
|
+
filePath: file.filePath,
|
|
32
|
+
type: 'program'
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
artifacts,
|
|
38
|
+
tmpDir
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Extracts a contract function as a standalone program artifact JSON string. */ export function makeFunctionArtifact(artifact, func) {
|
|
42
|
+
/* eslint-disable camelcase */ return JSON.stringify({
|
|
43
|
+
noir_version: artifact.noir_version,
|
|
44
|
+
hash: 0,
|
|
45
|
+
abi: func.abi,
|
|
46
|
+
bytecode: func.bytecode,
|
|
47
|
+
debug_symbols: func.debug_symbols,
|
|
48
|
+
file_map: artifact.file_map
|
|
49
|
+
});
|
|
50
|
+
/* eslint-enable camelcase */ }
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
genesis: import("@aztec/stdlib/world-state").GenesisData;
|
|
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
|
+
registryAddress: EthAddress;
|
|
24
|
+
rollupVersion?: number;
|
|
25
|
+
}, expected: {
|
|
26
|
+
genesisArchiveRoot: Fr;
|
|
27
|
+
vkTreeRoot: Fr;
|
|
28
|
+
protocolContractsHash: Fr;
|
|
29
|
+
}, port: number | undefined, userLog: LogFn): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhbmRieS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3N0YW5kYnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFHakQsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUVqRSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUVoRSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQVNuRDs7OztHQUlHO0FBQ0gsd0JBQXNCLDBCQUEwQixDQUFDLE1BQU0sRUFBRSxrQkFBa0IsRUFBRSxPQUFPLEVBQUUsS0FBSzs7O0dBYTFGO0FBd0JEOzs7OztHQUtHO0FBQ0gsd0JBQXNCLHVCQUF1QixDQUMzQyxNQUFNLEVBQUU7SUFDTixTQUFTLEVBQUUsTUFBTSxFQUFFLENBQUM7SUFDcEIsU0FBUyxFQUFFLE1BQU0sQ0FBQztJQUNsQixlQUFlLEVBQUUsVUFBVSxDQUFDO0lBQzVCLGFBQWEsQ0FBQyxFQUFFLE1BQU0sQ0FBQztDQUN4QixFQUNELFFBQVEsRUFBRTtJQUFFLGtCQUFrQixFQUFFLEVBQUUsQ0FBQztJQUFDLFVBQVUsRUFBRSxFQUFFLENBQUM7SUFBQyxxQkFBcUIsRUFBRSxFQUFFLENBQUE7Q0FBRSxFQUMvRSxJQUFJLEVBQUUsTUFBTSxHQUFHLFNBQVMsRUFDeEIsT0FBTyxFQUFFLEtBQUssR0FDYixPQUFPLENBQUMsSUFBSSxDQUFDLENBd0RmIn0=
|
|
@@ -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,eAAe,EAAE,UAAU,CAAC;IAC5B,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, genesis } = await getGenesisValues(initialFundedAccounts);
|
|
24
|
+
userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
|
|
25
|
+
return {
|
|
26
|
+
genesisArchiveRoot,
|
|
27
|
+
genesis
|
|
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.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
|
+
}
|
|
@@ -5,4 +5,4 @@ import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
|
5
5
|
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
6
6
|
export declare function startBot(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, userLog: LogFn): Promise<void>;
|
|
7
7
|
export declare function addBot(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, wallet: EmbeddedWallet, aztecNode: AztecNode, telemetry: TelemetryClient, aztecNodeAdmin?: AztecNodeAdmin, userLog?: LogFn): Promise<void>;
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfYm90LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2NtZHMvc3RhcnRfYm90LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDL0UsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFHbkQsT0FBTyxFQUFFLEtBQUssU0FBUyxFQUFFLEtBQUssY0FBYyxFQUF5QixNQUFNLGlDQUFpQyxDQUFDO0FBQzdHLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBTS9ELE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUt6RCx3QkFBc0IsUUFBUSxDQUM1QixPQUFPLEVBQUUsR0FBRyxFQUNaLGNBQWMsRUFBRSxDQUFDLE1BQU0sT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLEVBQUUsRUFDdkMsUUFBUSxFQUFFLHFCQUFxQixFQUMvQixPQUFPLEVBQUUsS0FBSyxpQkFzQmY7QUFFRCx3QkFBc0IsTUFBTSxDQUMxQixPQUFPLEVBQUUsR0FBRyxFQUNaLGNBQWMsRUFBRSxDQUFDLE1BQU0sT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLEVBQUUsRUFDdkMsUUFBUSxFQUFFLHFCQUFxQixFQUMvQixNQUFNLEVBQUUsY0FBYyxFQUN0QixTQUFTLEVBQUUsU0FBUyxFQUNwQixTQUFTLEVBQUUsZUFBZSxFQUMxQixjQUFjLENBQUMsRUFBRSxjQUFjLEVBQy9CLE9BQU8sQ0FBQyxFQUFFLEtBQUssaUJBbUJoQiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_bot.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_bot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAyB,MAAM,iCAAiC,CAAC;AAC7G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM/D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAKzD,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"start_bot.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_bot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAyB,MAAM,iCAAiC,CAAC;AAC7G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM/D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAKzD,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,iBAsBf;AAED,wBAAsB,MAAM,CAC1B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,eAAe,EAC1B,cAAc,CAAC,EAAE,cAAc,EAC/B,OAAO,CAAC,EAAE,KAAK,iBAmBhB"}
|
|
@@ -7,9 +7,9 @@ import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
|
7
7
|
import { extractRelevantOptions, stringifyConfig } from '../util.js';
|
|
8
8
|
import { getVersions } from '../versioning.js';
|
|
9
9
|
export async function startBot(options, signalHandlers, services, userLog) {
|
|
10
|
-
const { proverNode,
|
|
11
|
-
if (proverNode ||
|
|
12
|
-
userLog(`Starting a bot with --prover-node, --prover, --
|
|
10
|
+
const { proverNode, sequencer, p2pBootstrap, txe, prover } = options;
|
|
11
|
+
if (proverNode || sequencer || p2pBootstrap || txe || prover) {
|
|
12
|
+
userLog(`Starting a bot with --prover-node, --prover, --sequencer, --p2p-bootstrap, or --txe is not supported.`);
|
|
13
13
|
process.exit(1);
|
|
14
14
|
}
|
|
15
15
|
const fetch = makeTracedFetch([
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfbm9kZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3N0YXJ0X25vZGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUE2QyxNQUFNLG1CQUFtQixDQUFDO0FBS3BHLE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBZSxNQUFNLDBCQUEwQixDQUFDO0FBQzFFLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFFL0UsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUE4Qm5ELHdCQUFzQixTQUFTLENBQzdCLE9BQU8sRUFBRSxHQUFHLEVBQ1osY0FBYyxFQUFFLENBQUMsTUFBTSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsRUFBRSxFQUN2QyxRQUFRLEVBQUUscUJBQXFCLEVBQy9CLGFBQWEsRUFBRSxxQkFBcUIsRUFDcEMsT0FBTyxFQUFFLEtBQUssRUFDZCxXQUFXLEVBQUUsWUFBWSxHQUN4QixPQUFPLENBQUM7SUFBRSxNQUFNLEVBQUUsZUFBZSxDQUFBO0NBQUUsQ0FBQyxDQTRKdEMifQ==
|
|
@@ -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;AA8BnD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,aAAa,EAAE,qBAAqB,EACpC,OAAO,EAAE,KAAK,EACd,WAAW,EAAE,YAAY,GACxB,OAAO,CAAC;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CA4JtC"}
|
|
@@ -1,23 +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';
|
|
5
|
+
import { getGenesisStateConfigEnvVars } from '@aztec/ethereum/config';
|
|
7
6
|
import { SecretValue } from '@aztec/foundation/config';
|
|
8
7
|
import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
|
|
9
|
-
import {
|
|
8
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
9
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
10
|
+
import { ProvingJobConsumerSchema, createProvingJobBrokerClient, proverBrokerBackoff } from '@aztec/prover-client/broker';
|
|
10
11
|
import { allPxeConfigMappings } from '@aztec/pxe/config';
|
|
11
12
|
import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
12
13
|
import { P2PApiSchema, ProverNodeApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
13
14
|
import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } from '@aztec/telemetry-client';
|
|
14
15
|
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
15
|
-
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
16
16
|
import { createAztecNode } from '../../local-network/index.js';
|
|
17
|
-
import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying,
|
|
17
|
+
import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying, setupVersionChecker } from '../util.js';
|
|
18
18
|
import { getVersions } from '../versioning.js';
|
|
19
|
+
import { computeExpectedGenesisRoot, waitForCompatibleRollup } from './standby.js';
|
|
19
20
|
import { startProverBroker } from './start_prover_broker.js';
|
|
20
|
-
export async function startNode(options, signalHandlers, services, adminServices, userLog) {
|
|
21
|
+
export async function startNode(options, signalHandlers, services, adminServices, userLog, networkName) {
|
|
21
22
|
// All options set from environment variables
|
|
22
23
|
const configFromEnvVars = getConfigEnvVars();
|
|
23
24
|
// Extract relevant options from command line arguments
|
|
@@ -38,20 +39,8 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
38
39
|
if (nodeConfig.proverBrokerUrl) {
|
|
39
40
|
// at 1TPS we'd enqueue ~1k chonk verifier proofs and ~1k AVM proofs immediately
|
|
40
41
|
// set a lower connection limit such that we don't overload the server
|
|
41
|
-
//
|
|
42
|
-
const fetch = makeTracedFetch(
|
|
43
|
-
1,
|
|
44
|
-
2,
|
|
45
|
-
3,
|
|
46
|
-
3,
|
|
47
|
-
3,
|
|
48
|
-
3,
|
|
49
|
-
3,
|
|
50
|
-
3,
|
|
51
|
-
3,
|
|
52
|
-
3,
|
|
53
|
-
3
|
|
54
|
-
], false, makeUndiciFetch(new Agent({
|
|
42
|
+
// Retry indefinitely until the epoch proving times out and the chain reorgs
|
|
43
|
+
const fetch = makeTracedFetch(proverBrokerBackoff, false, makeUndiciFetch(new Agent({
|
|
55
44
|
connections: 100
|
|
56
45
|
})));
|
|
57
46
|
broker = createProvingJobBrokerClient(nodeConfig.proverBrokerUrl, getVersions(nodeConfig), fetch);
|
|
@@ -63,30 +52,27 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
63
52
|
}
|
|
64
53
|
}
|
|
65
54
|
await preloadCrsDataForVerifying(nodeConfig, userLog);
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
await getSponsoredFPCAddress()
|
|
69
|
-
] : [];
|
|
70
|
-
const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts);
|
|
71
|
-
userLog(`Initial funded accounts: ${initialFundedAccounts.map((a)=>a.toString()).join(', ')}`);
|
|
72
|
-
const { genesisArchiveRoot, prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
|
|
73
|
-
userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
|
|
55
|
+
const genesisConfig = getGenesisStateConfigEnvVars();
|
|
56
|
+
const { genesisArchiveRoot, genesis } = await computeExpectedGenesisRoot(genesisConfig, userLog);
|
|
74
57
|
const followsCanonicalRollup = typeof nodeConfig.rollupVersion !== 'number' || nodeConfig.rollupVersion === 'canonical';
|
|
75
|
-
if (!nodeConfig.
|
|
58
|
+
if (!nodeConfig.registryAddress || nodeConfig.registryAddress.isZero()) {
|
|
76
59
|
throw new Error('L1 registry address is required to start Aztec Node');
|
|
77
60
|
}
|
|
78
|
-
|
|
61
|
+
// Wait for a compatible rollup before proceeding with full L1 config fetch.
|
|
62
|
+
// This prevents crashes when the canonical rollup hasn't been upgraded yet.
|
|
63
|
+
await waitForCompatibleRollup(nodeConfig, {
|
|
64
|
+
genesisArchiveRoot,
|
|
65
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
66
|
+
protocolContractsHash
|
|
67
|
+
}, options.port, userLog);
|
|
68
|
+
const { addresses, config } = await getL1Config(nodeConfig.registryAddress, nodeConfig.l1RpcUrls, nodeConfig.l1ChainId, nodeConfig.rollupVersion);
|
|
79
69
|
process.env.ROLLUP_CONTRACT_ADDRESS ??= addresses.rollupAddress.toString();
|
|
80
70
|
if (!Fr.fromHexString(config.genesisArchiveTreeRoot).equals(genesisArchiveRoot)) {
|
|
81
71
|
throw new Error(`The computed genesis archive tree root ${genesisArchiveRoot} does not match the expected genesis archive tree root ${config.genesisArchiveTreeRoot} for the rollup deployed at ${addresses.rollupAddress}`);
|
|
82
72
|
}
|
|
83
|
-
// TODO(#12272): will clean this up.
|
|
84
73
|
nodeConfig = {
|
|
85
74
|
...nodeConfig,
|
|
86
|
-
|
|
87
|
-
...addresses,
|
|
88
|
-
slashFactoryAddress: nodeConfig.l1Contracts.slashFactoryAddress
|
|
89
|
-
},
|
|
75
|
+
...addresses,
|
|
90
76
|
...config
|
|
91
77
|
};
|
|
92
78
|
if (!options.sequencer && !nodeConfig.fishermanMode) {
|
|
@@ -119,7 +105,7 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
119
105
|
telemetry,
|
|
120
106
|
proverBroker: broker
|
|
121
107
|
}, {
|
|
122
|
-
|
|
108
|
+
genesis
|
|
123
109
|
});
|
|
124
110
|
// Add node and p2p to services list
|
|
125
111
|
services.node = [
|
|
@@ -159,10 +145,12 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
159
145
|
});
|
|
160
146
|
await addBot(options, signalHandlers, services, wallet, node, telemetry, undefined);
|
|
161
147
|
}
|
|
162
|
-
if (nodeConfig.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
148
|
+
if (nodeConfig.enableVersionCheck && networkName !== 'local') {
|
|
149
|
+
const cacheDir = process.env.DATA_DIRECTORY ? `${process.env.DATA_DIRECTORY}/cache` : undefined;
|
|
150
|
+
try {
|
|
151
|
+
await setupVersionChecker(networkName, followsCanonicalRollup, getPublicClient(nodeConfig), signalHandlers, cacheDir);
|
|
152
|
+
} catch {
|
|
153
|
+
/* no-op */ }
|
|
166
154
|
}
|
|
167
155
|
return {
|
|
168
156
|
config: nodeConfig
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
3
|
export declare function startProverAgent(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, userLog: LogFn): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfcHJvdmVyX2FnZW50LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2NtZHMvc3RhcnRfcHJvdmVyX2FnZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFFL0UsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFpQm5ELHdCQUFzQixnQkFBZ0IsQ0FDcEMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsRUFDL0IsT0FBTyxFQUFFLEtBQUssaUJBb0RmIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_prover_agent.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"start_prover_agent.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAiBnD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,iBAoDf"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { times } from '@aztec/foundation/collection';
|
|
2
2
|
import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
|
|
3
3
|
import { buildServerCircuitProver } from '@aztec/prover-client';
|
|
4
|
-
import { ProvingAgent, createProofStore, createProvingJobBrokerClient, proverAgentConfigMappings } from '@aztec/prover-client/broker';
|
|
4
|
+
import { ProvingAgent, createProofStore, createProvingJobBrokerClient, proverAgentConfigMappings, proverBrokerBackoff } from '@aztec/prover-client/broker';
|
|
5
5
|
import { getProverNodeAgentConfigFromEnv } from '@aztec/prover-node';
|
|
6
6
|
import { ProverAgentApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
7
7
|
import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } from '@aztec/telemetry-client';
|
|
8
8
|
import { extractRelevantOptions, preloadCrsDataForServerSideProving } from '../util.js';
|
|
9
9
|
import { getVersions } from '../versioning.js';
|
|
10
10
|
export async function startProverAgent(options, signalHandlers, services, userLog) {
|
|
11
|
-
if (options.node || options.sequencer || options.
|
|
12
|
-
userLog(`Starting a prover agent with --node, --sequencer, --
|
|
11
|
+
if (options.node || options.sequencer || options.p2pBootstrap || options.txe) {
|
|
12
|
+
userLog(`Starting a prover agent with --node, --sequencer, --p2p-bootstrap, or --txe is not supported.`);
|
|
13
13
|
process.exit(1);
|
|
14
14
|
}
|
|
15
15
|
const config = {
|
|
@@ -25,20 +25,8 @@ export async function startProverAgent(options, signalHandlers, services, userLo
|
|
|
25
25
|
process.exit(1);
|
|
26
26
|
}
|
|
27
27
|
await preloadCrsDataForServerSideProving(config, userLog);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
1,
|
|
31
|
-
2,
|
|
32
|
-
3,
|
|
33
|
-
3,
|
|
34
|
-
3,
|
|
35
|
-
3,
|
|
36
|
-
3,
|
|
37
|
-
3,
|
|
38
|
-
3,
|
|
39
|
-
3,
|
|
40
|
-
3
|
|
41
|
-
], false, makeUndiciFetch(new Agent({
|
|
28
|
+
// Retry indefinitely until the epoch proving times out and the chain reorgs
|
|
29
|
+
const fetch = makeTracedFetch(proverBrokerBackoff, false, makeUndiciFetch(new Agent({
|
|
42
30
|
connections: 10
|
|
43
31
|
})));
|
|
44
32
|
const broker = createProvingJobBrokerClient(config.proverBrokerUrl, getVersions(), fetch);
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfcHJvdmVyX2Jyb2tlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3N0YXJ0X3Byb3Zlcl9icm9rZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUMvRSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUduRCxPQUFPLEVBQ0wsS0FBSyxrQkFBa0IsRUFLeEIsTUFBTSw2QkFBNkIsQ0FBQztBQUVyQyxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBTXhFLHdCQUFzQixpQkFBaUIsQ0FDckMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsRUFDL0IsT0FBTyxFQUFFLEtBQUssR0FDYixPQUFPLENBQUM7SUFBRSxNQUFNLEVBQUUsZ0JBQWdCLENBQUM7SUFBQyxNQUFNLEVBQUUsa0JBQWtCLENBQUE7Q0FBRSxDQUFDLENBMkNuRSJ9
|
|
@@ -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,CA2CnE"}
|