@aztec/aztec 0.0.1-commit.f2ce05ee → 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 +7 -3
- package/dest/cli/admin_api_key_store.d.ts +45 -0
- package/dest/cli/admin_api_key_store.d.ts.map +1 -0
- package/dest/cli/admin_api_key_store.js +98 -0
- package/dest/cli/aztec_start_action.d.ts +1 -1
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +56 -15
- 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 +24 -8
- package/dest/cli/cli.d.ts +1 -1
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +0 -1
- 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 +68 -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 +51 -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 +57 -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 +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_bot.d.ts +3 -3
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +9 -5
- 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 +83 -27
- 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/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/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/util.d.ts +7 -18
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +47 -83
- package/dest/examples/token.js +6 -6
- package/dest/local-network/banana_fpc.js +1 -1
- package/dest/local-network/local-network.d.ts +3 -1
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +50 -18
- package/dest/testing/anvil_test_watcher.d.ts +9 -1
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +52 -15
- 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 +7 -3
- package/src/bin/index.ts +7 -3
- package/src/cli/admin_api_key_store.ts +128 -0
- package/src/cli/aztec_start_action.ts +58 -11
- package/src/cli/aztec_start_options.ts +26 -7
- package/src/cli/cli.ts +0 -1
- package/src/cli/cmds/compile.ts +80 -0
- package/src/cli/cmds/profile.ts +25 -0
- package/src/cli/cmds/profile_flamegraph.ts +63 -0
- package/src/cli/cmds/profile_gates.ts +67 -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 +8 -5
- package/src/cli/cmds/start_node.ts +83 -33
- package/src/cli/cmds/start_prover_broker.ts +14 -14
- package/src/cli/cmds/utils/artifacts.ts +44 -0
- package/src/cli/cmds/utils/spawn.ts +16 -0
- package/src/cli/util.ts +55 -93
- package/src/examples/token.ts +8 -6
- package/src/local-network/banana_fpc.ts +1 -1
- package/src/local-network/local-network.ts +54 -17
- package/src/testing/anvil_test_watcher.ts +59 -15
- 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/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/scripts/compile.sh +0 -44
- package/scripts/extract_function.js +0 -47
- package/scripts/flamegraph.sh +0 -59
- package/src/cli/cmds/start_prover_node.ts +0 -124
- package/src/cli/release_version.ts +0 -21
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { asyncPool } from '@aztec/foundation/async-pool';
|
|
2
|
+
import { execFile as execFileCb } from 'child_process';
|
|
3
|
+
import { rm } from 'fs/promises';
|
|
4
|
+
import { promisify } from 'util';
|
|
5
|
+
import { MAX_CONCURRENT, discoverArtifacts } from './profile_utils.js';
|
|
6
|
+
const execFile = promisify(execFileCb);
|
|
7
|
+
/** Parses circuit_size from bb gates JSON output: { "functions": [{ "circuit_size": N }] } */ function parseGateCount(stdout) {
|
|
8
|
+
const parsed = JSON.parse(stdout);
|
|
9
|
+
const size = parsed?.functions?.[0]?.circuit_size;
|
|
10
|
+
if (typeof size !== 'number') {
|
|
11
|
+
throw new Error('Failed to parse circuit_size from bb gates output');
|
|
12
|
+
}
|
|
13
|
+
return size;
|
|
14
|
+
}
|
|
15
|
+
/** Runs bb gates on a single artifact file and returns the gate count. */ async function getGateCount(bb, artifactPath) {
|
|
16
|
+
const { stdout } = await execFile(bb, [
|
|
17
|
+
'gates',
|
|
18
|
+
'--scheme',
|
|
19
|
+
'chonk',
|
|
20
|
+
'-b',
|
|
21
|
+
artifactPath
|
|
22
|
+
]);
|
|
23
|
+
return parseGateCount(stdout);
|
|
24
|
+
}
|
|
25
|
+
/** Profiles all compiled artifacts in a target directory and prints gate counts. */ export async function profileGates(targetDir, log) {
|
|
26
|
+
const bb = process.env.BB ?? 'bb';
|
|
27
|
+
const { artifacts, tmpDir } = await discoverArtifacts(targetDir);
|
|
28
|
+
if (artifacts.length === 0) {
|
|
29
|
+
log('No artifacts found in target directory.');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const results = await asyncPool(MAX_CONCURRENT, artifacts, async (artifact)=>({
|
|
34
|
+
name: artifact.name,
|
|
35
|
+
gateCount: await getGateCount(bb, artifact.filePath)
|
|
36
|
+
}));
|
|
37
|
+
results.sort((a, b)=>a.name.localeCompare(b.name));
|
|
38
|
+
if (results.length === 0) {
|
|
39
|
+
log('No constrained circuits found.');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const maxNameLen = Math.max(...results.map((r)=>r.name.length));
|
|
43
|
+
log('');
|
|
44
|
+
log('Gate counts:');
|
|
45
|
+
log('-'.repeat(maxNameLen + 16));
|
|
46
|
+
for (const { name, gateCount } of results){
|
|
47
|
+
log(`${name.padEnd(maxNameLen)} ${gateCount.toLocaleString().padStart(12)}`);
|
|
48
|
+
}
|
|
49
|
+
log('-'.repeat(maxNameLen + 16));
|
|
50
|
+
log(`Total: ${results.length} circuit(s)`);
|
|
51
|
+
} finally{
|
|
52
|
+
await rm(tmpDir, {
|
|
53
|
+
recursive: true,
|
|
54
|
+
force: true
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -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,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
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
3
|
import { type AztecNode, type AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
4
4
|
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
5
|
-
import {
|
|
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
|
-
export declare function addBot(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, wallet:
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfYm90LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2NtZHMvc3RhcnRfYm90LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDL0UsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFHbkQsT0FBTyxFQUFFLEtBQUssU0FBUyxFQUFFLEtBQUssY0FBYyxFQUF5QixNQUFNLGlDQUFpQyxDQUFDO0FBQzdHLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBTS9ELE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUt6RCx3QkFBc0IsUUFBUSxDQUM1QixPQUFPLEVBQUUsR0FBRyxFQUNaLGNBQWMsRUFBRSxDQUFDLE1BQU0sT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLEVBQUUsRUFDdkMsUUFBUSxFQUFFLHFCQUFxQixFQUMvQixPQUFPLEVBQUUsS0FBSyxpQkF3QmY7QUFFRCx3QkFBc0IsTUFBTSxDQUMxQixPQUFPLEVBQUUsR0FBRyxFQUNaLGNBQWMsRUFBRSxDQUFDLE1BQU0sT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLEVBQUUsRUFDdkMsUUFBUSxFQUFFLHFCQUFxQixFQUMvQixNQUFNLEVBQUUsY0FBYyxFQUN0QixTQUFTLEVBQUUsU0FBUyxFQUNwQixTQUFTLEVBQUUsZUFBZSxFQUMxQixjQUFjLENBQUMsRUFBRSxjQUFjLEVBQy9CLE9BQU8sQ0FBQyxFQUFFLEtBQUssaUJBbUJoQiJ9
|
|
@@ -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,
|
|
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,iBAwBf;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"}
|
|
@@ -3,8 +3,8 @@ import { createStore, openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
|
3
3
|
import { allPxeConfigMappings } from '@aztec/pxe/config';
|
|
4
4
|
import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
5
5
|
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient, makeTracedFetch } from '@aztec/telemetry-client';
|
|
6
|
-
import {
|
|
7
|
-
import { extractRelevantOptions } from '../util.js';
|
|
6
|
+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
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
10
|
const { proverNode, archiver, sequencer, p2pBootstrap, txe, prover } = options;
|
|
@@ -23,12 +23,16 @@ export async function startBot(options, signalHandlers, services, userLog) {
|
|
|
23
23
|
}
|
|
24
24
|
const aztecNode = createAztecNodeClient(config.nodeUrl, getVersions(), fetch);
|
|
25
25
|
const pxeConfig = extractRelevantOptions(options, allPxeConfigMappings, 'pxe');
|
|
26
|
-
|
|
26
|
+
userLog(`Creating bot wallet with config ${stringifyConfig(pxeConfig)}`);
|
|
27
|
+
const wallet = await EmbeddedWallet.create(aztecNode, {
|
|
28
|
+
pxeConfig
|
|
29
|
+
});
|
|
27
30
|
const telemetry = await initTelemetryClient(getTelemetryClientConfig());
|
|
28
|
-
await addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, undefined);
|
|
31
|
+
await addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, undefined, userLog);
|
|
29
32
|
}
|
|
30
|
-
export async function addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, aztecNodeAdmin) {
|
|
33
|
+
export async function addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, aztecNodeAdmin, userLog) {
|
|
31
34
|
const config = extractRelevantOptions(options, botConfigMappings, 'bot');
|
|
35
|
+
userLog?.(`Starting bot with config ${stringifyConfig(config)}`);
|
|
32
36
|
const db = await (config.dataDirectory ? createStore('bot', BotStore.SCHEMA_VERSION, config) : openTmpStore('bot', true, config.dataStoreMapSizeKb));
|
|
33
37
|
const store = new BotStore(db);
|
|
34
38
|
await store.cleanupOldClaims();
|
|
@@ -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,19 +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';
|
|
7
|
+
import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
|
|
8
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
9
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
10
|
+
import { ProvingJobConsumerSchema, createProvingJobBrokerClient } from '@aztec/prover-client/broker';
|
|
8
11
|
import { allPxeConfigMappings } from '@aztec/pxe/config';
|
|
9
12
|
import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
10
|
-
import { P2PApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
11
|
-
import { initTelemetryClient, telemetryClientConfigMappings } from '@aztec/telemetry-client';
|
|
12
|
-
import {
|
|
13
|
-
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
13
|
+
import { P2PApiSchema, ProverNodeApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
14
|
+
import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } from '@aztec/telemetry-client';
|
|
15
|
+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
14
16
|
import { createAztecNode } from '../../local-network/index.js';
|
|
15
|
-
import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying,
|
|
16
|
-
|
|
17
|
+
import { extractNamespacedOptions, extractRelevantOptions, preloadCrsDataForVerifying, setupVersionChecker } from '../util.js';
|
|
18
|
+
import { getVersions } from '../versioning.js';
|
|
19
|
+
import { computeExpectedGenesisRoot, waitForCompatibleRollup } from './standby.js';
|
|
20
|
+
import { startProverBroker } from './start_prover_broker.js';
|
|
21
|
+
export async function startNode(options, signalHandlers, services, adminServices, userLog, networkName) {
|
|
17
22
|
// All options set from environment variables
|
|
18
23
|
const configFromEnvVars = getConfigEnvVars();
|
|
19
24
|
// Extract relevant options from command line arguments
|
|
@@ -23,23 +28,55 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
23
28
|
...configFromEnvVars,
|
|
24
29
|
...relevantOptions
|
|
25
30
|
};
|
|
31
|
+
// Prover node configuration and broker setup
|
|
32
|
+
// REFACTOR: Move the broker setup out of here and into the prover-node factory
|
|
33
|
+
let broker = undefined;
|
|
26
34
|
if (options.proverNode) {
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
nodeConfig.enableProverNode = true;
|
|
36
|
+
if (nodeConfig.proverAgentCount === 0) {
|
|
37
|
+
userLog(`Running prover node without local prover agent. Connect prover agents or pass --proverAgent.proverAgentCount`);
|
|
38
|
+
}
|
|
39
|
+
if (nodeConfig.proverBrokerUrl) {
|
|
40
|
+
// at 1TPS we'd enqueue ~1k chonk verifier proofs and ~1k AVM proofs immediately
|
|
41
|
+
// set a lower connection limit such that we don't overload the server
|
|
42
|
+
// Keep retrying up to 30s
|
|
43
|
+
const fetch = makeTracedFetch([
|
|
44
|
+
1,
|
|
45
|
+
2,
|
|
46
|
+
3,
|
|
47
|
+
3,
|
|
48
|
+
3,
|
|
49
|
+
3,
|
|
50
|
+
3,
|
|
51
|
+
3,
|
|
52
|
+
3,
|
|
53
|
+
3,
|
|
54
|
+
3
|
|
55
|
+
], false, makeUndiciFetch(new Agent({
|
|
56
|
+
connections: 100
|
|
57
|
+
})));
|
|
58
|
+
broker = createProvingJobBrokerClient(nodeConfig.proverBrokerUrl, getVersions(nodeConfig), fetch);
|
|
59
|
+
} else if (options.proverBroker) {
|
|
60
|
+
({ broker } = await startProverBroker(options, signalHandlers, services, userLog));
|
|
61
|
+
} else {
|
|
62
|
+
userLog(`--prover-broker-url or --prover-broker is required to start a Prover Node`);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
29
65
|
}
|
|
30
66
|
await preloadCrsDataForVerifying(nodeConfig, userLog);
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
await getSponsoredFPCAddress()
|
|
34
|
-
] : [];
|
|
35
|
-
const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts);
|
|
36
|
-
userLog(`Initial funded accounts: ${initialFundedAccounts.map((a)=>a.toString()).join(', ')}`);
|
|
37
|
-
const { genesisArchiveRoot, prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
|
|
38
|
-
userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
|
|
67
|
+
const genesisConfig = getGenesisStateConfigEnvVars();
|
|
68
|
+
const { genesisArchiveRoot, prefilledPublicData } = await computeExpectedGenesisRoot(genesisConfig, userLog);
|
|
39
69
|
const followsCanonicalRollup = typeof nodeConfig.rollupVersion !== 'number' || nodeConfig.rollupVersion === 'canonical';
|
|
40
70
|
if (!nodeConfig.l1Contracts.registryAddress || nodeConfig.l1Contracts.registryAddress.isZero()) {
|
|
41
71
|
throw new Error('L1 registry address is required to start Aztec Node');
|
|
42
72
|
}
|
|
73
|
+
// Wait for a compatible rollup before proceeding with full L1 config fetch.
|
|
74
|
+
// This prevents crashes when the canonical rollup hasn't been upgraded yet.
|
|
75
|
+
await waitForCompatibleRollup(nodeConfig, {
|
|
76
|
+
genesisArchiveRoot,
|
|
77
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
78
|
+
protocolContractsHash
|
|
79
|
+
}, options.port, userLog);
|
|
43
80
|
const { addresses, config } = await getL1Config(nodeConfig.l1Contracts.registryAddress, nodeConfig.l1RpcUrls, nodeConfig.l1ChainId, nodeConfig.rollupVersion);
|
|
44
81
|
process.env.ROLLUP_CONTRACT_ADDRESS ??= addresses.rollupAddress.toString();
|
|
45
82
|
if (!Fr.fromHexString(config.genesisArchiveTreeRoot).equals(genesisArchiveRoot)) {
|
|
@@ -62,14 +99,14 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
62
99
|
...extractNamespacedOptions(options, 'sequencer')
|
|
63
100
|
};
|
|
64
101
|
// If no publisher private keys have been given, use the first validator key
|
|
65
|
-
if (sequencerConfig.
|
|
102
|
+
if (sequencerConfig.sequencerPublisherPrivateKeys === undefined || !sequencerConfig.sequencerPublisherPrivateKeys.length) {
|
|
66
103
|
if (sequencerConfig.validatorPrivateKeys?.getValue().length) {
|
|
67
|
-
sequencerConfig.
|
|
104
|
+
sequencerConfig.sequencerPublisherPrivateKeys = [
|
|
68
105
|
new SecretValue(sequencerConfig.validatorPrivateKeys.getValue()[0])
|
|
69
106
|
];
|
|
70
107
|
}
|
|
71
108
|
}
|
|
72
|
-
nodeConfig.
|
|
109
|
+
nodeConfig.sequencerPublisherPrivateKeys = sequencerConfig.sequencerPublisherPrivateKeys;
|
|
73
110
|
}
|
|
74
111
|
if (nodeConfig.p2pEnabled) {
|
|
75
112
|
// ensure bootstrapNodes is an array
|
|
@@ -81,7 +118,8 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
81
118
|
const telemetry = await initTelemetryClient(telemetryConfig);
|
|
82
119
|
// Create and start Aztec Node
|
|
83
120
|
const node = await createAztecNode(nodeConfig, {
|
|
84
|
-
telemetry
|
|
121
|
+
telemetry,
|
|
122
|
+
proverBroker: broker
|
|
85
123
|
}, {
|
|
86
124
|
prefilledPublicData
|
|
87
125
|
});
|
|
@@ -98,19 +136,37 @@ export async function startNode(options, signalHandlers, services, adminServices
|
|
|
98
136
|
node,
|
|
99
137
|
AztecNodeAdminApiSchema
|
|
100
138
|
];
|
|
139
|
+
// Register prover-node services if the prover node subsystem is running
|
|
140
|
+
const proverNode = node.getProverNode();
|
|
141
|
+
if (proverNode) {
|
|
142
|
+
services.prover = [
|
|
143
|
+
proverNode,
|
|
144
|
+
ProverNodeApiSchema
|
|
145
|
+
];
|
|
146
|
+
if (!nodeConfig.proverBrokerUrl) {
|
|
147
|
+
services.provingJobSource = [
|
|
148
|
+
proverNode.getProver().getProvingJobSource(),
|
|
149
|
+
ProvingJobConsumerSchema
|
|
150
|
+
];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
101
153
|
// Add node stop function to signal handlers
|
|
102
154
|
signalHandlers.push(node.stop.bind(node));
|
|
103
155
|
// Add a txs bot if requested
|
|
104
156
|
if (options.bot) {
|
|
105
157
|
const { addBot } = await import('./start_bot.js');
|
|
106
158
|
const pxeConfig = extractRelevantOptions(options, allPxeConfigMappings, 'pxe');
|
|
107
|
-
const wallet = await
|
|
159
|
+
const wallet = await EmbeddedWallet.create(node, {
|
|
160
|
+
pxeConfig
|
|
161
|
+
});
|
|
108
162
|
await addBot(options, signalHandlers, services, wallet, node, telemetry, undefined);
|
|
109
163
|
}
|
|
110
|
-
if (nodeConfig.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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 */ }
|
|
114
170
|
}
|
|
115
171
|
return {
|
|
116
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
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface CompiledArtifact {
|
|
2
|
+
noir_version: string;
|
|
3
|
+
file_map: unknown;
|
|
4
|
+
functions: ContractFunction[];
|
|
5
|
+
bytecode?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ContractFunction {
|
|
8
|
+
name: string;
|
|
9
|
+
abi: unknown;
|
|
10
|
+
bytecode: string;
|
|
11
|
+
debug_symbols: unknown;
|
|
12
|
+
is_unconstrained?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ArtifactFile {
|
|
15
|
+
name: string;
|
|
16
|
+
filePath: string;
|
|
17
|
+
content: CompiledArtifact;
|
|
18
|
+
}
|
|
19
|
+
/** Reads all JSON artifact files from a target directory and returns their parsed contents. */
|
|
20
|
+
export declare function readArtifactFiles(targetDir: string): Promise<ArtifactFile[]>;
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJ0aWZhY3RzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvYXJ0aWZhY3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE1BQU0sV0FBVyxnQkFBZ0I7SUFDL0IsWUFBWSxFQUFFLE1BQU0sQ0FBQztJQUNyQixRQUFRLEVBQUUsT0FBTyxDQUFDO0lBQ2xCLFNBQVMsRUFBRSxnQkFBZ0IsRUFBRSxDQUFDO0lBQzlCLFFBQVEsQ0FBQyxFQUFFLE1BQU0sQ0FBQztDQUNuQjtBQUVELE1BQU0sV0FBVyxnQkFBZ0I7SUFDL0IsSUFBSSxFQUFFLE1BQU0sQ0FBQztJQUNiLEdBQUcsRUFBRSxPQUFPLENBQUM7SUFDYixRQUFRLEVBQUUsTUFBTSxDQUFDO0lBQ2pCLGFBQWEsRUFBRSxPQUFPLENBQUM7SUFDdkIsZ0JBQWdCLENBQUMsRUFBRSxPQUFPLENBQUM7Q0FDNUI7QUFFRCxNQUFNLFdBQVcsWUFBWTtJQUMzQixJQUFJLEVBQUUsTUFBTSxDQUFDO0lBQ2IsUUFBUSxFQUFFLE1BQU0sQ0FBQztJQUNqQixPQUFPLEVBQUUsZ0JBQWdCLENBQUM7Q0FDM0I7QUFFRCwrRkFBK0Y7QUFDL0Ysd0JBQXNCLGlCQUFpQixDQUFDLFNBQVMsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLFlBQVksRUFBRSxDQUFDLENBa0JsRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/artifacts.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,+FAA+F;AAC/F,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAkBlF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { readFile, readdir } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
/** Reads all JSON artifact files from a target directory and returns their parsed contents. */ export async function readArtifactFiles(targetDir) {
|
|
4
|
+
let entries;
|
|
5
|
+
try {
|
|
6
|
+
entries = (await readdir(targetDir)).filter((f)=>f.endsWith('.json'));
|
|
7
|
+
} catch (err) {
|
|
8
|
+
if (err?.code === 'ENOENT') {
|
|
9
|
+
throw new Error(`Target directory '${targetDir}' does not exist. Compile first with 'aztec compile'.`);
|
|
10
|
+
}
|
|
11
|
+
throw err;
|
|
12
|
+
}
|
|
13
|
+
const artifacts = [];
|
|
14
|
+
for (const file of entries){
|
|
15
|
+
const filePath = join(targetDir, file);
|
|
16
|
+
const content = JSON.parse(await readFile(filePath, 'utf-8'));
|
|
17
|
+
artifacts.push({
|
|
18
|
+
name: file.replace('.json', ''),
|
|
19
|
+
filePath,
|
|
20
|
+
content
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return artifacts;
|
|
24
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Spawns a command with inherited stdio and rejects on non-zero exit. */
|
|
2
|
+
export declare function run(cmd: string, args: string[]): Promise<void>;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Bhd24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jbGkvY21kcy91dGlscy9zcGF3bi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSwwRUFBMEU7QUFDMUUsd0JBQWdCLEdBQUcsQ0FBQyxHQUFHLEVBQUUsTUFBTSxFQUFFLElBQUksRUFBRSxNQUFNLEVBQUUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBWTlEIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/spawn.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAY9D"}
|