@aztec/aztec 0.0.1-commit.381b1a9 → 0.0.1-commit.3a4ae741b
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/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 +5 -1
- package/dest/cli/aztec_start_options.js +1 -1
- 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 +99 -1
- package/dest/cli/cmds/profile_flamegraph.d.ts +1 -1
- package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -1
- package/dest/cli/cmds/profile_flamegraph.js +2 -1
- package/dest/cli/cmds/profile_gates.d.ts +1 -1
- package/dest/cli/cmds/profile_gates.d.ts.map +1 -1
- package/dest/cli/cmds/profile_gates.js +2 -1
- package/dest/cli/cmds/start_archiver.d.ts +2 -2
- package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
- package/dest/cli/cmds/start_archiver.js +1 -1
- 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 +134 -0
- package/dest/cli/util.js +3 -3
- package/dest/testing/anvil_test_watcher.js +1 -1
- package/dest/testing/cheat_codes.js +1 -1
- package/package.json +34 -34
- package/scripts/add_crate.sh +102 -0
- package/scripts/aztec.sh +4 -2
- package/scripts/init.sh +23 -19
- package/scripts/new.sh +48 -24
- package/scripts/setup_workspace.sh +68 -0
- package/src/cli/aztec_start_action.ts +2 -1
- package/src/cli/aztec_start_options.ts +1 -1
- package/src/cli/cli.ts +3 -3
- package/src/cli/cmds/compile.ts +112 -1
- package/src/cli/cmds/profile_flamegraph.ts +2 -1
- package/src/cli/cmds/profile_gates.ts +2 -1
- package/src/cli/cmds/start_archiver.ts +1 -1
- package/src/cli/cmds/utils/needs_recompile.ts +151 -0
- package/src/cli/util.ts +2 -2
- package/src/testing/anvil_test_watcher.ts +1 -1
- package/src/testing/cheat_codes.ts +1 -1
- package/scripts/setup_project.sh +0 -31
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
2
|
export declare function aztecStart(options: any, userLog: LogFn, debugLogger: Logger): Promise<void>;
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXp0ZWNfc3RhcnRfYWN0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL2F6dGVjX3N0YXJ0X2FjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFhM0Qsd0JBQXNCLFVBQVUsQ0FBQyxPQUFPLEVBQUUsR0FBRyxFQUFFLE9BQU8sRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0saUJBMklqRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aztec_start_action.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_action.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAa3D,wBAAsB,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"aztec_start_action.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_action.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAa3D,wBAAsB,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBA2IjF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getActiveNetworkName } from '@aztec/foundation/config';
|
|
2
2
|
import { createNamespacedSafeJsonRpcServer, getApiKeyAuthMiddleware, startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
3
|
-
import { AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
3
|
+
import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
4
4
|
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
5
5
|
import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
|
|
6
6
|
import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
|
|
@@ -38,6 +38,10 @@ export async function aztecStart(options, userLog, debugLogger) {
|
|
|
38
38
|
node,
|
|
39
39
|
AztecNodeApiSchema
|
|
40
40
|
];
|
|
41
|
+
adminServices.node = [
|
|
42
|
+
node,
|
|
43
|
+
AztecNodeAdminApiSchema
|
|
44
|
+
];
|
|
41
45
|
} else {
|
|
42
46
|
// Route --prover-node through startNode
|
|
43
47
|
if (options.proverNode && !options.node) {
|
|
@@ -6,7 +6,6 @@ import { l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresse
|
|
|
6
6
|
import { l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
|
|
7
7
|
import { getKeys } from '@aztec/foundation/collection';
|
|
8
8
|
import { booleanConfigHelper, isBooleanConfigValue, omitConfigMappings } from '@aztec/foundation/config';
|
|
9
|
-
import { dataConfigMappings } from '@aztec/kv-store/config';
|
|
10
9
|
import { sharedNodeConfigMappings } from '@aztec/node-lib/config';
|
|
11
10
|
import { bootnodeConfigMappings, p2pConfigMappings } from '@aztec/p2p/config';
|
|
12
11
|
import { proverAgentConfigMappings, proverBrokerConfigMappings } from '@aztec/prover-client/broker/config';
|
|
@@ -14,6 +13,7 @@ import { proverNodeConfigMappings } from '@aztec/prover-node/config';
|
|
|
14
13
|
import { allPxeConfigMappings } from '@aztec/pxe/config';
|
|
15
14
|
import { sequencerClientConfigMappings } from '@aztec/sequencer-client/config';
|
|
16
15
|
import { chainConfigMappings, nodeRpcConfigMappings } from '@aztec/stdlib/config';
|
|
16
|
+
import { dataConfigMappings } from '@aztec/stdlib/kv-store';
|
|
17
17
|
import { telemetryClientConfigMappings } from '@aztec/telemetry-client/config';
|
|
18
18
|
import { worldStateConfigMappings } from '@aztec/world-state/config';
|
|
19
19
|
import { DefaultMnemonic } from '../mnemonic.js';
|
package/dest/cli/cli.js
CHANGED
|
@@ -24,9 +24,9 @@ import { addOptions, printAztecStartHelpText } from './util.js';
|
|
|
24
24
|
program.addHelpText('after', `
|
|
25
25
|
Additional commands:
|
|
26
26
|
|
|
27
|
-
init
|
|
28
|
-
new <
|
|
29
|
-
test [options]
|
|
27
|
+
init creates a new Aztec Noir workspace in the current directory.
|
|
28
|
+
new <name> creates a new Aztec Noir workspace in its own directory (or creates a new contract-test crates pair and adds it to the current workspace if run in workspace).
|
|
29
|
+
test [options] starts a TXE and runs "nargo test" using it as the oracle resolver.
|
|
30
30
|
`);
|
|
31
31
|
}
|
|
32
32
|
program.command('preload-crs').description('Preload the points data needed for proving and verifying').action(async (options)=>{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
import type { Command } from 'commander';
|
|
3
3
|
export declare function injectCompileCommand(program: Command, log: LogFn): Command;
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGlsZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL2NvbXBpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFHbkQsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBb0t6Qyx3QkFBZ0Isb0JBQW9CLENBQUMsT0FBTyxFQUFFLE9BQU8sRUFBRSxHQUFHLEVBQUUsS0FBSyxHQUFHLE9BQU8sQ0FzQjFFIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/compile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/compile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoKzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAsB1E"}
|
package/dest/cli/cmds/compile.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { findBbBinary } from '@aztec/bb.js';
|
|
1
2
|
import { execFileSync } from 'child_process';
|
|
2
3
|
import { readFile, writeFile } from 'fs/promises';
|
|
4
|
+
import { join } from 'path';
|
|
3
5
|
import { readArtifactFiles } from './utils/artifacts.js';
|
|
6
|
+
import { needsRecompile } from './utils/needs_recompile.js';
|
|
4
7
|
import { run } from './utils/spawn.js';
|
|
5
8
|
/** Returns paths to contract artifacts in the target directory. */ async function collectContractArtifacts() {
|
|
6
9
|
let files;
|
|
@@ -25,13 +28,108 @@ import { run } from './utils/spawn.js';
|
|
|
25
28
|
await writeFile(path, JSON.stringify(artifact, null, 2) + '\n');
|
|
26
29
|
}
|
|
27
30
|
}
|
|
31
|
+
/** Returns the set of package names that are contract crates in the current workspace. */ async function getContractPackageNames() {
|
|
32
|
+
const contractNames = new Set();
|
|
33
|
+
let rootToml;
|
|
34
|
+
try {
|
|
35
|
+
rootToml = await readFile('Nargo.toml', 'utf-8');
|
|
36
|
+
} catch {
|
|
37
|
+
return contractNames;
|
|
38
|
+
}
|
|
39
|
+
const membersMatch = rootToml.match(/members\s*=\s*\[([^\]]*)\]/);
|
|
40
|
+
if (membersMatch) {
|
|
41
|
+
const members = membersMatch[1].split(',').map((m)=>m.trim().replace(/^"|"$/g, '')).filter((m)=>m.length > 0);
|
|
42
|
+
for (const member of members){
|
|
43
|
+
try {
|
|
44
|
+
const memberToml = await readFile(join(member, 'Nargo.toml'), 'utf-8');
|
|
45
|
+
if (/type\s*=\s*"contract"/.test(memberToml)) {
|
|
46
|
+
const nameMatch = memberToml.match(/name\s*=\s*"([^"]+)"/);
|
|
47
|
+
if (nameMatch) {
|
|
48
|
+
contractNames.add(nameMatch[1]);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
// Member directory might not exist or have no Nargo.toml; skip.
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
// Single-crate project (no workspace): check if the root Nargo.toml itself is a contract.
|
|
57
|
+
if (/type\s*=\s*"contract"/.test(rootToml)) {
|
|
58
|
+
const nameMatch = rootToml.match(/name\s*=\s*"([^"]+)"/);
|
|
59
|
+
if (nameMatch) {
|
|
60
|
+
contractNames.add(nameMatch[1]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return contractNames;
|
|
65
|
+
}
|
|
66
|
+
/** Checks that no tests exist in contract crates and fails with a helpful message if they do. */ async function checkNoTestsInContracts(nargo, log) {
|
|
67
|
+
const contractPackages = await getContractPackageNames();
|
|
68
|
+
if (contractPackages.size === 0) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
let output;
|
|
72
|
+
try {
|
|
73
|
+
// We list tests for all the crates in the workspace
|
|
74
|
+
output = execFileSync(nargo, [
|
|
75
|
+
'test',
|
|
76
|
+
'--list-tests',
|
|
77
|
+
'--silence-warnings'
|
|
78
|
+
], {
|
|
79
|
+
encoding: 'utf-8',
|
|
80
|
+
stdio: [
|
|
81
|
+
'pipe',
|
|
82
|
+
'pipe',
|
|
83
|
+
'inherit'
|
|
84
|
+
]
|
|
85
|
+
});
|
|
86
|
+
} catch {
|
|
87
|
+
// If listing tests fails (e.g. test crate has compile errors), skip the check.
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
// The output of the `nargo test --list-tests` command is as follows:
|
|
91
|
+
// ```
|
|
92
|
+
// crate_name_1 test_name_1
|
|
93
|
+
// crate_name_2 test_name_2
|
|
94
|
+
// ...
|
|
95
|
+
// crate_name_n test_name_n
|
|
96
|
+
// ```
|
|
97
|
+
//
|
|
98
|
+
// We parse the individual lines and then we check if any contract crate appeared in the parsed output.
|
|
99
|
+
const lines = output.trim().split('\n').filter((line)=>line.length > 0);
|
|
100
|
+
const testsInContracts = [];
|
|
101
|
+
for (const line of lines){
|
|
102
|
+
const spaceIndex = line.indexOf(' ');
|
|
103
|
+
if (spaceIndex === -1) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const packageName = line.substring(0, spaceIndex);
|
|
107
|
+
const testName = line.substring(spaceIndex + 1);
|
|
108
|
+
if (contractPackages.has(packageName)) {
|
|
109
|
+
testsInContracts.push({
|
|
110
|
+
packageName,
|
|
111
|
+
testName
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (testsInContracts.length > 0) {
|
|
116
|
+
const details = testsInContracts.map((t)=>` ${t.packageName}::${t.testName}`).join('\n');
|
|
117
|
+
log(`WARNING: Found tests in contract crate(s):\n${details}\n\n` + `Tests should be in a dedicated test crate, not in the contract crate.\n` + `Learn more: https://docs.aztec.network/errors/1`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
28
120
|
/** Compiles Aztec Noir contracts and postprocesses artifacts. */ async function compileAztecContract(nargoArgs, log) {
|
|
121
|
+
if (!await needsRecompile()) {
|
|
122
|
+
log('No source changes detected, skipping compilation.');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
29
125
|
const nargo = process.env.NARGO ?? 'nargo';
|
|
30
|
-
const bb = process.env.BB ?? 'bb';
|
|
126
|
+
const bb = process.env.BB ?? findBbBinary() ?? 'bb';
|
|
31
127
|
await run(nargo, [
|
|
32
128
|
'compile',
|
|
33
129
|
...nargoArgs
|
|
34
130
|
]);
|
|
131
|
+
// Ensure contract crates contain no tests (tests belong in the test crate).
|
|
132
|
+
await checkNoTestsInContracts(nargo, log);
|
|
35
133
|
const artifacts = await collectContractArtifacts();
|
|
36
134
|
if (artifacts.length > 0) {
|
|
37
135
|
log('Postprocessing contracts...');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
/** Generates a gate count flamegraph SVG for a single contract function. */
|
|
3
3
|
export declare function profileFlamegraph(artifactPath: string, functionName: string, log: LogFn): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZV9mbGFtZWdyYXBoLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2NtZHMvcHJvZmlsZV9mbGFtZWdyYXBoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBU25ELDRFQUE0RTtBQUM1RSx3QkFBc0IsaUJBQWlCLENBQUMsWUFBWSxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsTUFBTSxFQUFFLEdBQUcsRUFBRSxLQUFLLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQW9EN0cifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile_flamegraph.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile_flamegraph.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profile_flamegraph.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile_flamegraph.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AASnD,4EAA4E;AAC5E,wBAAsB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAoD7G"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { findBbBinary } from '@aztec/bb.js';
|
|
1
2
|
import { readFile, rename, rm, writeFile } from 'fs/promises';
|
|
2
3
|
import { basename, dirname, join } from 'path';
|
|
3
4
|
import { makeFunctionArtifact } from './profile_utils.js';
|
|
@@ -22,7 +23,7 @@ import { run } from './utils/spawn.js';
|
|
|
22
23
|
try {
|
|
23
24
|
await writeFile(functionArtifact, makeFunctionArtifact(artifact, func));
|
|
24
25
|
const profiler = process.env.PROFILER_PATH ?? 'noir-profiler';
|
|
25
|
-
const bb = process.env.BB ?? 'bb';
|
|
26
|
+
const bb = process.env.BB ?? findBbBinary() ?? 'bb';
|
|
26
27
|
await run(profiler, [
|
|
27
28
|
'gates',
|
|
28
29
|
'--artifact-path',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
/** Profiles all compiled artifacts in a target directory and prints gate counts. */
|
|
3
3
|
export declare function profileGates(targetDir: string, log: LogFn): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZV9nYXRlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3Byb2ZpbGVfZ2F0ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUErQm5ELG9GQUFvRjtBQUNwRix3QkFBc0IsWUFBWSxDQUFDLFNBQVMsRUFBRSxNQUFNLEVBQUUsR0FBRyxFQUFFLEtBQUssR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBaUMvRSJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile_gates.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile_gates.ts"],"names":[],"mappings":"
|
|
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;AA+BnD,oFAAoF;AACpF,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAiC/E"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { findBbBinary } from '@aztec/bb.js';
|
|
1
2
|
import { asyncPool } from '@aztec/foundation/async-pool';
|
|
2
3
|
import { execFile as execFileCb } from 'child_process';
|
|
3
4
|
import { rm } from 'fs/promises';
|
|
@@ -23,7 +24,7 @@ const execFile = promisify(execFileCb);
|
|
|
23
24
|
return parseGateCount(stdout);
|
|
24
25
|
}
|
|
25
26
|
/** 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 bb = process.env.BB ?? findBbBinary() ?? 'bb';
|
|
27
28
|
const { artifacts, tmpDir } = await discoverArtifacts(targetDir);
|
|
28
29
|
if (artifacts.length === 0) {
|
|
29
30
|
log('No artifacts found in target directory.');
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ArchiverConfig } from '@aztec/archiver';
|
|
2
2
|
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
3
|
-
import { type DataStoreConfig } from '@aztec/kv-store
|
|
3
|
+
import { type DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
4
4
|
export type { ArchiverConfig, DataStoreConfig };
|
|
5
5
|
/** Starts a standalone archiver. */
|
|
6
6
|
export declare function startArchiver(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers): Promise<{
|
|
7
7
|
config: ArchiverConfig & DataStoreConfig;
|
|
8
8
|
}>;
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfYXJjaGl2ZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvY21kcy9zdGFydF9hcmNoaXZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQW9FLE1BQU0saUJBQWlCLENBQUM7QUFJeEgsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUUvRSxPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQXNCLE1BQU0sd0JBQXdCLENBQUM7QUFLbEYsWUFBWSxFQUFFLGNBQWMsRUFBRSxlQUFlLEVBQUUsQ0FBQztBQUVoRCxvQ0FBb0M7QUFDcEMsd0JBQXNCLGFBQWEsQ0FDakMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsR0FDOUIsT0FBTyxDQUFDO0lBQUUsTUFBTSxFQUFFLGNBQWMsR0FBRyxlQUFlLENBQUE7Q0FBRSxDQUFDLENBK0J2RCJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_archiver.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAoE,MAAM,iBAAiB,CAAC;AAIxH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"start_archiver.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAoE,MAAM,iBAAiB,CAAC;AAIxH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAKlF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAEhD,oCAAoC;AACpC,wBAAsB,aAAa,CACjC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,GAAG,eAAe,CAAA;CAAE,CAAC,CA+BvD"}
|
|
@@ -2,8 +2,8 @@ import { archiverConfigMappings, createArchiver, getArchiverConfigFromEnv } from
|
|
|
2
2
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
3
3
|
import { blobClientConfigMapping, createBlobClient } from '@aztec/blob-client/client';
|
|
4
4
|
import { getL1Config } from '@aztec/cli/config';
|
|
5
|
-
import { dataConfigMappings } from '@aztec/kv-store/config';
|
|
6
5
|
import { ArchiverApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
6
|
+
import { dataConfigMappings } from '@aztec/stdlib/kv-store';
|
|
7
7
|
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
8
8
|
import { extractRelevantOptions } from '../util.js';
|
|
9
9
|
/** Starts a standalone archiver. */ export async function startArchiver(options, signalHandlers, services) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if recompilation is needed: either no artifacts exist in target/ or any .nr or Nargo.toml source file
|
|
3
|
+
* (including path-based dependencies) is newer than the oldest artifact. We compare against the oldest artifact so
|
|
4
|
+
* that a source change between the oldest and newest compilation (e.g. in a multi-contract workspace) still triggers
|
|
5
|
+
* a recompile.
|
|
6
|
+
*
|
|
7
|
+
* Note: The above implies that if there is a random json file in the target dir we would be always recompiling.
|
|
8
|
+
*/
|
|
9
|
+
export declare function needsRecompile(): Promise<boolean>;
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmVlZHNfcmVjb21waWxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvbmVlZHNfcmVjb21waWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0IsY0FBYyxJQUFJLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FRdkQifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"needs_recompile.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/needs_recompile.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAQvD"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import TOML from '@iarna/toml';
|
|
2
|
+
import { readFile, readdir, stat } from 'fs/promises';
|
|
3
|
+
import { join, resolve } from 'path';
|
|
4
|
+
/**
|
|
5
|
+
* Returns true if recompilation is needed: either no artifacts exist in target/ or any .nr or Nargo.toml source file
|
|
6
|
+
* (including path-based dependencies) is newer than the oldest artifact. We compare against the oldest artifact so
|
|
7
|
+
* that a source change between the oldest and newest compilation (e.g. in a multi-contract workspace) still triggers
|
|
8
|
+
* a recompile.
|
|
9
|
+
*
|
|
10
|
+
* Note: The above implies that if there is a random json file in the target dir we would be always recompiling.
|
|
11
|
+
*/ export async function needsRecompile() {
|
|
12
|
+
const oldestArtifactMs = await getOldestArtifactModificationTime('target');
|
|
13
|
+
if (oldestArtifactMs === undefined) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
const crateDirs = await collectCrateDirs('.');
|
|
17
|
+
return hasNewerSourceFile(crateDirs, oldestArtifactMs);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns the last modification time (timestamp in ms) of the oldest .json artifact in targetDir, or undefined if
|
|
21
|
+
* none exist.
|
|
22
|
+
*/ async function getOldestArtifactModificationTime(targetDir) {
|
|
23
|
+
let entries;
|
|
24
|
+
try {
|
|
25
|
+
entries = (await readdir(targetDir)).filter((f)=>f.endsWith('.json'));
|
|
26
|
+
} catch (err) {
|
|
27
|
+
if (err?.code === 'ENOENT') {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
throw err;
|
|
31
|
+
}
|
|
32
|
+
if (entries.length === 0) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
let oldest = Infinity;
|
|
36
|
+
for (const entry of entries){
|
|
37
|
+
const s = await stat(join(targetDir, entry));
|
|
38
|
+
if (s.mtimeMs < oldest) {
|
|
39
|
+
oldest = s.mtimeMs;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return oldest;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Recursively collects crate directories starting from startCrateDir by following path-based dependencies declared in
|
|
46
|
+
* Nargo.toml files. Git-based deps are ignored (they only change when Nargo.toml itself is modified since the deps are
|
|
47
|
+
* tagged).
|
|
48
|
+
*/ async function collectCrateDirs(startCrateDir) {
|
|
49
|
+
// We have a set of visited dirs we check against when entering a new dir because we could stumble upon a directory
|
|
50
|
+
// multiple times in case multiple deps shared a dep (e.g. dep A and dep B both sharing dep C).
|
|
51
|
+
const visited = new Set();
|
|
52
|
+
async function visit(crateDir) {
|
|
53
|
+
const absDir = resolve(crateDir);
|
|
54
|
+
if (visited.has(absDir)) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
visited.add(absDir);
|
|
58
|
+
// Every dep is its own crate and every crate needs to have Nargo.toml defined in the root so we try to load it and
|
|
59
|
+
// error out if it's not the case.
|
|
60
|
+
const tomlPath = join(absDir, 'Nargo.toml');
|
|
61
|
+
const content = await readFile(tomlPath, 'utf-8').catch(()=>{
|
|
62
|
+
throw new Error(`Incorrectly defined dependency. Nargo.toml not found in ${absDir}`);
|
|
63
|
+
});
|
|
64
|
+
const parsed = TOML.parse(content);
|
|
65
|
+
const members = parsed.workspace?.members;
|
|
66
|
+
// A Nargo.toml is either a workspace root (has workspace.members) or a single crate (has dependencies).
|
|
67
|
+
if (Array.isArray(members)) {
|
|
68
|
+
// The crate is a workspace root and has members defined so we visit the members
|
|
69
|
+
for (const member of members){
|
|
70
|
+
const memberPath = resolve(absDir, member);
|
|
71
|
+
await visit(memberPath);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
// The crate is not a workspace root so we check for dependencies
|
|
75
|
+
const deps = parsed.dependencies ?? {};
|
|
76
|
+
for (const dep of Object.values(deps)){
|
|
77
|
+
if (dep && typeof dep === 'object' && typeof dep.path === 'string') {
|
|
78
|
+
const depPath = resolve(absDir, dep.path);
|
|
79
|
+
const s = await stat(depPath);
|
|
80
|
+
if (!s.isDirectory()) {
|
|
81
|
+
throw new Error(`Dependency path "${dep.path}" in ${tomlPath} resolves to ${depPath} which is not a directory`);
|
|
82
|
+
}
|
|
83
|
+
await visit(depPath);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
await visit(startCrateDir);
|
|
89
|
+
return [
|
|
90
|
+
...visited
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Walks crate dirs looking for .nr and Nargo.toml files newer than thresholdMs. Short-circuits on the first match.
|
|
95
|
+
*/ async function hasNewerSourceFile(crateDirs, thresholdMs) {
|
|
96
|
+
// Returns true if it find a new file than thresholdMs, false otherwise
|
|
97
|
+
async function walkForNewer(dir) {
|
|
98
|
+
let entries;
|
|
99
|
+
try {
|
|
100
|
+
entries = await readdir(dir, {
|
|
101
|
+
withFileTypes: true
|
|
102
|
+
});
|
|
103
|
+
} catch {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
// We iterate over the entries in the dir
|
|
107
|
+
for (const entry of entries){
|
|
108
|
+
const fullPath = join(dir, entry.name);
|
|
109
|
+
if (entry.isDirectory()) {
|
|
110
|
+
// If the entry is a dir and it's not called `target` we recursively enter it
|
|
111
|
+
if (entry.name === 'target') {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (await walkForNewer(fullPath)) {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
} else if (entry.name === 'Nargo.toml' || entry.name.endsWith('.nr')) {
|
|
118
|
+
// The entry is a Nargo.toml file or *.nr file so we check the timestamp
|
|
119
|
+
const s = await stat(fullPath);
|
|
120
|
+
if (s.mtimeMs > thresholdMs) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
// We search through the crate dirs
|
|
128
|
+
for (const dir of crateDirs){
|
|
129
|
+
if (await walkForNewer(dir)) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
}
|
package/dest/cli/util.js
CHANGED
|
@@ -222,7 +222,7 @@ export const printAztecStartHelpText = ()=>{
|
|
|
222
222
|
const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
|
|
223
223
|
await Promise.all([
|
|
224
224
|
Crs.new(2 ** 1, undefined, log),
|
|
225
|
-
GrumpkinCrs.new(2 ** 16
|
|
225
|
+
GrumpkinCrs.new(2 ** 16, undefined, log)
|
|
226
226
|
]);
|
|
227
227
|
}
|
|
228
228
|
}
|
|
@@ -234,8 +234,8 @@ export const printAztecStartHelpText = ()=>{
|
|
|
234
234
|
if (realProofs) {
|
|
235
235
|
const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
|
|
236
236
|
await Promise.all([
|
|
237
|
-
Crs.new(2 ** 25
|
|
238
|
-
GrumpkinCrs.new(2 ** 18
|
|
237
|
+
Crs.new(2 ** 25, undefined, log),
|
|
238
|
+
GrumpkinCrs.new(2 ** 18, undefined, log)
|
|
239
239
|
]);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
@@ -101,7 +101,7 @@ import { getAddress, getContract } from 'viem';
|
|
|
101
101
|
if (!this.dateProvider) {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
const l1Time = await this.cheatcodes.
|
|
104
|
+
const l1Time = await this.cheatcodes.lastBlockTimestamp() * 1000;
|
|
105
105
|
const wallTime = this.dateProvider.now();
|
|
106
106
|
if (l1Time > wallTime) {
|
|
107
107
|
this.logger.warn(`L1 is ahead of wall time. Syncing wall time to L1 time`);
|
|
@@ -55,7 +55,7 @@ import { retryUntil } from '@aztec/foundation/retry';
|
|
|
55
55
|
* @param node - The Aztec node used to query if a new block has been mined.
|
|
56
56
|
* @param duration - The duration to advance time by (in seconds)
|
|
57
57
|
*/ async warpL2TimeAtLeastBy(sequencerClient, node, duration) {
|
|
58
|
-
const currentTimestamp = await this.eth.
|
|
58
|
+
const currentTimestamp = await this.eth.lastBlockTimestamp();
|
|
59
59
|
const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
|
|
60
60
|
await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
|
|
61
61
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.3a4ae741b",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -28,39 +28,39 @@
|
|
|
28
28
|
"../package.common.json"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
32
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
33
|
-
"@aztec/aztec-
|
|
34
|
-
"@aztec/aztec
|
|
35
|
-
"@aztec/
|
|
36
|
-
"@aztec/bb
|
|
37
|
-
"@aztec/
|
|
38
|
-
"@aztec/
|
|
39
|
-
"@aztec/
|
|
40
|
-
"@aztec/
|
|
41
|
-
"@aztec/
|
|
42
|
-
"@aztec/
|
|
43
|
-
"@aztec/
|
|
44
|
-
"@aztec/
|
|
45
|
-
"@aztec/
|
|
46
|
-
"@aztec/
|
|
47
|
-
"@aztec/
|
|
48
|
-
"@aztec/
|
|
49
|
-
"@aztec/noir-
|
|
50
|
-
"@aztec/
|
|
51
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
52
|
-
"@aztec/
|
|
53
|
-
"@aztec/
|
|
54
|
-
"@aztec/prover-
|
|
55
|
-
"@aztec/
|
|
56
|
-
"@aztec/
|
|
57
|
-
"@aztec/
|
|
58
|
-
"@aztec/
|
|
59
|
-
"@aztec/
|
|
60
|
-
"@aztec/
|
|
61
|
-
"@aztec/
|
|
62
|
-
"@aztec/
|
|
63
|
-
"@
|
|
31
|
+
"@aztec/accounts": "0.0.1-commit.3a4ae741b",
|
|
32
|
+
"@aztec/archiver": "0.0.1-commit.3a4ae741b",
|
|
33
|
+
"@aztec/aztec-node": "0.0.1-commit.3a4ae741b",
|
|
34
|
+
"@aztec/aztec.js": "0.0.1-commit.3a4ae741b",
|
|
35
|
+
"@aztec/bb-prover": "0.0.1-commit.3a4ae741b",
|
|
36
|
+
"@aztec/bb.js": "0.0.1-commit.3a4ae741b",
|
|
37
|
+
"@aztec/blob-client": "0.0.1-commit.3a4ae741b",
|
|
38
|
+
"@aztec/bot": "0.0.1-commit.3a4ae741b",
|
|
39
|
+
"@aztec/builder": "0.0.1-commit.3a4ae741b",
|
|
40
|
+
"@aztec/cli": "0.0.1-commit.3a4ae741b",
|
|
41
|
+
"@aztec/constants": "0.0.1-commit.3a4ae741b",
|
|
42
|
+
"@aztec/entrypoints": "0.0.1-commit.3a4ae741b",
|
|
43
|
+
"@aztec/ethereum": "0.0.1-commit.3a4ae741b",
|
|
44
|
+
"@aztec/foundation": "0.0.1-commit.3a4ae741b",
|
|
45
|
+
"@aztec/kv-store": "0.0.1-commit.3a4ae741b",
|
|
46
|
+
"@aztec/l1-artifacts": "0.0.1-commit.3a4ae741b",
|
|
47
|
+
"@aztec/node-lib": "0.0.1-commit.3a4ae741b",
|
|
48
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.3a4ae741b",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.3a4ae741b",
|
|
50
|
+
"@aztec/p2p": "0.0.1-commit.3a4ae741b",
|
|
51
|
+
"@aztec/p2p-bootstrap": "0.0.1-commit.3a4ae741b",
|
|
52
|
+
"@aztec/protocol-contracts": "0.0.1-commit.3a4ae741b",
|
|
53
|
+
"@aztec/prover-client": "0.0.1-commit.3a4ae741b",
|
|
54
|
+
"@aztec/prover-node": "0.0.1-commit.3a4ae741b",
|
|
55
|
+
"@aztec/pxe": "0.0.1-commit.3a4ae741b",
|
|
56
|
+
"@aztec/sequencer-client": "0.0.1-commit.3a4ae741b",
|
|
57
|
+
"@aztec/stdlib": "0.0.1-commit.3a4ae741b",
|
|
58
|
+
"@aztec/telemetry-client": "0.0.1-commit.3a4ae741b",
|
|
59
|
+
"@aztec/txe": "0.0.1-commit.3a4ae741b",
|
|
60
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.3a4ae741b",
|
|
61
|
+
"@aztec/wallets": "0.0.1-commit.3a4ae741b",
|
|
62
|
+
"@aztec/world-state": "0.0.1-commit.3a4ae741b",
|
|
63
|
+
"@iarna/toml": "^2.2.5",
|
|
64
64
|
"@types/chalk": "^2.2.0",
|
|
65
65
|
"abitype": "^0.8.11",
|
|
66
66
|
"chalk": "^5.3.0",
|