@aztec/aztec 4.0.0-nightly.20260111 → 4.0.0-nightly.20260113
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/cli.d.ts +1 -1
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +3 -15
- package/package.json +36 -35
- package/scripts/aztec.sh +56 -0
- package/scripts/compile.sh +44 -0
- package/scripts/extract_function.js +47 -0
- package/scripts/flamegraph.sh +59 -0
- package/scripts/init.sh +35 -0
- package/scripts/new.sh +59 -0
- package/scripts/setup_project.sh +31 -0
- package/src/cli/cli.ts +6 -18
package/dest/cli/cli.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ import { Command } from 'commander';
|
|
|
6
6
|
* @param debugLogger - logger for logging debug messages.
|
|
7
7
|
*/
|
|
8
8
|
export declare function injectAztecCommands(program: Command, userLog: LogFn, debugLogger: Logger): Command;
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL2NsaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFM0QsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLFdBQVcsQ0FBQztBQUtwQzs7OztHQUlHO0FBQ0gsd0JBQWdCLG1CQUFtQixDQUFDLE9BQU8sRUFBRSxPQUFPLEVBQUUsT0FBTyxFQUFFLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0E0RWxHIn0=
|
package/dest/cli/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CA4ElG"}
|
package/dest/cli/cli.js
CHANGED
|
@@ -20,7 +20,8 @@ import { addOptions, printAztecStartHelpText } from './util.js';
|
|
|
20
20
|
program.configureHelp({
|
|
21
21
|
sortSubcommands: true
|
|
22
22
|
});
|
|
23
|
-
|
|
23
|
+
if (process.env.AZTEC_SHELL_WRAPPER) {
|
|
24
|
+
program.addHelpText('after', `
|
|
24
25
|
|
|
25
26
|
Additional commands:
|
|
26
27
|
|
|
@@ -51,29 +52,16 @@ import { addOptions, printAztecStartHelpText } from './util.js';
|
|
|
51
52
|
The compiled contracts will be placed in the target/ directory by default.
|
|
52
53
|
Supports standard nargo compile options.
|
|
53
54
|
|
|
54
|
-
fmt [options]: formats Noir code using nargo fmt
|
|
55
|
-
Example:
|
|
56
|
-
$ aztec fmt # formats all Noir files in the project
|
|
57
|
-
|
|
58
|
-
check [options]: type-checks Noir code without compiling using nargo check
|
|
59
|
-
Example:
|
|
60
|
-
$ aztec check # checks all Noir files in the project
|
|
61
|
-
|
|
62
55
|
test [options]: starts a dockerized TXE node via
|
|
63
56
|
$ aztec start --txe
|
|
64
57
|
then runs
|
|
65
58
|
$ aztec test --silence-warnings --oracle-resolver=<TXE_ADDRESS> [options]
|
|
66
59
|
|
|
67
|
-
lsp: starts the Nargo Language Server Protocol server
|
|
68
|
-
Runs nargo lsp in a Docker container for IDE integration with Noir.
|
|
69
|
-
This command is typically used by IDE extensions and not called directly by users.
|
|
70
|
-
Example:
|
|
71
|
-
$ aztec lsp # starts the LSP server
|
|
72
|
-
|
|
73
60
|
preload-crs: Downloads and caches the Common Reference String (CRS) data required for zero-knowledge proofs.
|
|
74
61
|
Example:
|
|
75
62
|
$ aztec preload-crs # preloads CRS data
|
|
76
63
|
`);
|
|
64
|
+
}
|
|
77
65
|
program.command('preload-crs').description('Preload the points data needed for proving and verifying').action(async (options)=>{
|
|
78
66
|
const { preloadCrs } = await import('./preload_crs.js');
|
|
79
67
|
return await preloadCrs(options, userLog, debugLogger);
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec",
|
|
3
|
-
"version": "4.0.0-nightly.
|
|
3
|
+
"version": "4.0.0-nightly.20260113",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
7
7
|
"./testing": "./dest/testing/index.js"
|
|
8
8
|
},
|
|
9
|
-
"bin": "./
|
|
9
|
+
"bin": "./scripts/aztec.sh",
|
|
10
10
|
"typedocOptions": {
|
|
11
11
|
"entryPoints": [
|
|
12
12
|
"./src/index.ts"
|
|
@@ -28,39 +28,39 @@
|
|
|
28
28
|
"../package.common.json"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aztec/accounts": "4.0.0-nightly.
|
|
32
|
-
"@aztec/archiver": "4.0.0-nightly.
|
|
33
|
-
"@aztec/aztec-faucet": "4.0.0-nightly.
|
|
34
|
-
"@aztec/aztec-node": "4.0.0-nightly.
|
|
35
|
-
"@aztec/aztec.js": "4.0.0-nightly.
|
|
36
|
-
"@aztec/bb-prover": "4.0.0-nightly.
|
|
37
|
-
"@aztec/bb.js": "4.0.0-nightly.
|
|
38
|
-
"@aztec/blob-client": "4.0.0-nightly.
|
|
39
|
-
"@aztec/bot": "4.0.0-nightly.
|
|
40
|
-
"@aztec/builder": "4.0.0-nightly.
|
|
41
|
-
"@aztec/cli": "4.0.0-nightly.
|
|
42
|
-
"@aztec/constants": "4.0.0-nightly.
|
|
43
|
-
"@aztec/entrypoints": "4.0.0-nightly.
|
|
44
|
-
"@aztec/ethereum": "4.0.0-nightly.
|
|
45
|
-
"@aztec/foundation": "4.0.0-nightly.
|
|
46
|
-
"@aztec/kv-store": "4.0.0-nightly.
|
|
47
|
-
"@aztec/l1-artifacts": "4.0.0-nightly.
|
|
48
|
-
"@aztec/node-lib": "4.0.0-nightly.
|
|
49
|
-
"@aztec/noir-contracts.js": "4.0.0-nightly.
|
|
50
|
-
"@aztec/noir-protocol-circuits-types": "4.0.0-nightly.
|
|
51
|
-
"@aztec/p2p": "4.0.0-nightly.
|
|
52
|
-
"@aztec/p2p-bootstrap": "4.0.0-nightly.
|
|
53
|
-
"@aztec/protocol-contracts": "4.0.0-nightly.
|
|
54
|
-
"@aztec/prover-client": "4.0.0-nightly.
|
|
55
|
-
"@aztec/prover-node": "4.0.0-nightly.
|
|
56
|
-
"@aztec/pxe": "4.0.0-nightly.
|
|
57
|
-
"@aztec/sequencer-client": "4.0.0-nightly.
|
|
58
|
-
"@aztec/stdlib": "4.0.0-nightly.
|
|
59
|
-
"@aztec/telemetry-client": "4.0.0-nightly.
|
|
60
|
-
"@aztec/test-wallet": "4.0.0-nightly.
|
|
61
|
-
"@aztec/txe": "4.0.0-nightly.
|
|
62
|
-
"@aztec/validator-ha-signer": "4.0.0-nightly.
|
|
63
|
-
"@aztec/world-state": "4.0.0-nightly.
|
|
31
|
+
"@aztec/accounts": "4.0.0-nightly.20260113",
|
|
32
|
+
"@aztec/archiver": "4.0.0-nightly.20260113",
|
|
33
|
+
"@aztec/aztec-faucet": "4.0.0-nightly.20260113",
|
|
34
|
+
"@aztec/aztec-node": "4.0.0-nightly.20260113",
|
|
35
|
+
"@aztec/aztec.js": "4.0.0-nightly.20260113",
|
|
36
|
+
"@aztec/bb-prover": "4.0.0-nightly.20260113",
|
|
37
|
+
"@aztec/bb.js": "4.0.0-nightly.20260113",
|
|
38
|
+
"@aztec/blob-client": "4.0.0-nightly.20260113",
|
|
39
|
+
"@aztec/bot": "4.0.0-nightly.20260113",
|
|
40
|
+
"@aztec/builder": "4.0.0-nightly.20260113",
|
|
41
|
+
"@aztec/cli": "4.0.0-nightly.20260113",
|
|
42
|
+
"@aztec/constants": "4.0.0-nightly.20260113",
|
|
43
|
+
"@aztec/entrypoints": "4.0.0-nightly.20260113",
|
|
44
|
+
"@aztec/ethereum": "4.0.0-nightly.20260113",
|
|
45
|
+
"@aztec/foundation": "4.0.0-nightly.20260113",
|
|
46
|
+
"@aztec/kv-store": "4.0.0-nightly.20260113",
|
|
47
|
+
"@aztec/l1-artifacts": "4.0.0-nightly.20260113",
|
|
48
|
+
"@aztec/node-lib": "4.0.0-nightly.20260113",
|
|
49
|
+
"@aztec/noir-contracts.js": "4.0.0-nightly.20260113",
|
|
50
|
+
"@aztec/noir-protocol-circuits-types": "4.0.0-nightly.20260113",
|
|
51
|
+
"@aztec/p2p": "4.0.0-nightly.20260113",
|
|
52
|
+
"@aztec/p2p-bootstrap": "4.0.0-nightly.20260113",
|
|
53
|
+
"@aztec/protocol-contracts": "4.0.0-nightly.20260113",
|
|
54
|
+
"@aztec/prover-client": "4.0.0-nightly.20260113",
|
|
55
|
+
"@aztec/prover-node": "4.0.0-nightly.20260113",
|
|
56
|
+
"@aztec/pxe": "4.0.0-nightly.20260113",
|
|
57
|
+
"@aztec/sequencer-client": "4.0.0-nightly.20260113",
|
|
58
|
+
"@aztec/stdlib": "4.0.0-nightly.20260113",
|
|
59
|
+
"@aztec/telemetry-client": "4.0.0-nightly.20260113",
|
|
60
|
+
"@aztec/test-wallet": "4.0.0-nightly.20260113",
|
|
61
|
+
"@aztec/txe": "4.0.0-nightly.20260113",
|
|
62
|
+
"@aztec/validator-ha-signer": "4.0.0-nightly.20260113",
|
|
63
|
+
"@aztec/world-state": "4.0.0-nightly.20260113",
|
|
64
64
|
"@types/chalk": "^2.2.0",
|
|
65
65
|
"abitype": "^0.8.11",
|
|
66
66
|
"chalk": "^5.3.0",
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
},
|
|
72
72
|
"files": [
|
|
73
73
|
"dest",
|
|
74
|
+
"scripts",
|
|
74
75
|
"src",
|
|
75
76
|
"!*.test.*"
|
|
76
77
|
],
|
package/scripts/aztec.sh
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
script_dir="$(dirname "$(realpath "$0")")"
|
|
5
|
+
|
|
6
|
+
function aztec {
|
|
7
|
+
exec node --no-warnings $script_dir/../dest/bin/index.js "$@"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
cmd=${1:-}
|
|
11
|
+
[ -n "$cmd" ] && shift
|
|
12
|
+
|
|
13
|
+
export AZTEC_SHELL_WRAPPER=1
|
|
14
|
+
|
|
15
|
+
case $cmd in
|
|
16
|
+
test)
|
|
17
|
+
export LOG_LEVEL="${LOG_LEVEL:-info}"
|
|
18
|
+
aztec start --txe --port 8081 &
|
|
19
|
+
server_pid=$!
|
|
20
|
+
trap 'kill $server_pid &>/dev/null || true' EXIT
|
|
21
|
+
while ! nc -z 127.0.0.1 8081 &>/dev/null; do sleep 0.2; done
|
|
22
|
+
export NARGO_FOREIGN_CALL_TIMEOUT=300000
|
|
23
|
+
nargo test --silence-warnings --pedantic-solving --oracle-resolver http://127.0.0.1:8081 "$@"
|
|
24
|
+
;;
|
|
25
|
+
start)
|
|
26
|
+
if [ "${1:-}" == "--local-network" ]; then
|
|
27
|
+
# TODO: Can these just be set in TS?
|
|
28
|
+
export ARCHIVER_POLLING_INTERVAL_MS=500
|
|
29
|
+
export P2P_BLOCK_CHECK_INTERVAL_MS=500
|
|
30
|
+
export SEQ_TX_POLLING_INTERVAL_MS=500
|
|
31
|
+
export WS_BLOCK_CHECK_INTERVAL_MS=500
|
|
32
|
+
export ARCHIVER_VIEM_POLLING_INTERVAL_MS=500
|
|
33
|
+
export TEST_ACCOUNTS=${TEST_ACCOUNTS:-true}
|
|
34
|
+
export LOG_LEVEL=${LOG_LEVEL:-info;silent:sequencer;verbose:debug_log}
|
|
35
|
+
export DEPLOY_AZTEC_CONTRACTS_SALT=${DEPLOY_AZTEC_CONTRACTS_SALT:-$RANDOM}
|
|
36
|
+
|
|
37
|
+
ANVIL_PORT=${ANVIL_PORT:-8545}
|
|
38
|
+
|
|
39
|
+
export L1_CHAIN_ID=${L1_CHAIN_ID:-31337}
|
|
40
|
+
export ETHEREUM_HOSTS=${ETHEREUM_HOSTS:-"http://127.0.0.1:${ANVIL_PORT}"}
|
|
41
|
+
|
|
42
|
+
anvil --version
|
|
43
|
+
anvil --silent &
|
|
44
|
+
anvil_pid=$!
|
|
45
|
+
trap 'kill $anvil_pid &>/dev/null' EXIT
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
aztec start "$@"
|
|
49
|
+
;;
|
|
50
|
+
compile|new|init|flamegraph)
|
|
51
|
+
$script_dir/${cmd}.sh "$@"
|
|
52
|
+
;;
|
|
53
|
+
*)
|
|
54
|
+
aztec $cmd "$@"
|
|
55
|
+
;;
|
|
56
|
+
esac
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
NARGO=${NARGO:-nargo}
|
|
5
|
+
BB=${BB:-bb}
|
|
6
|
+
|
|
7
|
+
# If help is requested, show Aztec-specific info then run nargo compile help and then exit in order to not trigger
|
|
8
|
+
# transpilation
|
|
9
|
+
for arg in "$@"; do
|
|
10
|
+
if [ "$arg" == "--help" ] || [ "$arg" == "-h" ]; then
|
|
11
|
+
cat << 'EOF'
|
|
12
|
+
Aztec Compile - Compile Aztec Noir contracts
|
|
13
|
+
|
|
14
|
+
This command compiles Aztec Noir contracts using nargo and then automatically
|
|
15
|
+
postprocesses them to generate Aztec specific artifacts including:
|
|
16
|
+
- Transpiled contract artifacts
|
|
17
|
+
- Verification keys
|
|
18
|
+
|
|
19
|
+
The compiled contracts will be placed in the target/ directory by default.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
Underlying nargo compile options:
|
|
23
|
+
|
|
24
|
+
EOF
|
|
25
|
+
nargo compile --help
|
|
26
|
+
exit 0
|
|
27
|
+
fi
|
|
28
|
+
done
|
|
29
|
+
|
|
30
|
+
# Run nargo compile.
|
|
31
|
+
$NARGO compile "$@"
|
|
32
|
+
|
|
33
|
+
echo "Postprocessing contract..."
|
|
34
|
+
$BB aztec_process
|
|
35
|
+
|
|
36
|
+
# Strip internal prefixes from all compiled contract JSONs in target directory
|
|
37
|
+
# TODO: This should be part of bb aztec_process!
|
|
38
|
+
for json in target/*.json; do
|
|
39
|
+
temp_file="${json}.tmp"
|
|
40
|
+
jq '.functions |= map(.name |= sub("^__aztec_nr_internals__"; ""))' "$json" > "$temp_file"
|
|
41
|
+
mv "$temp_file" "$json"
|
|
42
|
+
done
|
|
43
|
+
|
|
44
|
+
echo "Compilation complete!"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'fs/promises';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
|
|
5
|
+
// Simple script to extract a contract function as a separate Noir artifact.
|
|
6
|
+
// We need to use this since the transpiling that we do on public functions make the contract artifacts
|
|
7
|
+
// unreadable by noir tooling, since they are no longer following the noir artifact format.
|
|
8
|
+
async function main() {
|
|
9
|
+
let [contractArtifactPath, functionName] = process.argv.slice(2);
|
|
10
|
+
if (!contractArtifactPath || !functionName) {
|
|
11
|
+
console.log('Usage: node extractFunctionAsNoirArtifact.js <contractArtifactPath> <functionName>');
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const contractArtifact = JSON.parse(await fs.readFile(contractArtifactPath, 'utf8'));
|
|
16
|
+
const func = contractArtifact.functions.find(f => f.name === functionName);
|
|
17
|
+
if (!func) {
|
|
18
|
+
console.error(`Function ${functionName} not found in ${contractArtifactPath}`);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const artifact = {
|
|
23
|
+
noir_version: contractArtifact.noir_version,
|
|
24
|
+
hash: 0,
|
|
25
|
+
abi: func.abi,
|
|
26
|
+
bytecode: func.bytecode,
|
|
27
|
+
debug_symbols: func.debug_symbols,
|
|
28
|
+
file_map: contractArtifact.file_map,
|
|
29
|
+
expression_width: {
|
|
30
|
+
Bounded: {
|
|
31
|
+
width: 4,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const outputDir = path.dirname(contractArtifactPath);
|
|
37
|
+
const outputName = path.basename(contractArtifactPath, '.json') + `-${functionName}.json`;
|
|
38
|
+
|
|
39
|
+
const outPath = path.join(outputDir, outputName);
|
|
40
|
+
|
|
41
|
+
await fs.writeFile(outPath, JSON.stringify(artifact, null, 2));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
main().catch(err => {
|
|
45
|
+
console.error(err);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
# If first arg is -h or --help, print usage.
|
|
5
|
+
if [ $# -lt 2 ] || [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
|
|
6
|
+
cat << 'EOF'
|
|
7
|
+
Aztec Flamegraph - Generate a gate count flamegraph for an aztec contract function.
|
|
8
|
+
|
|
9
|
+
Usage: aztec flamegraph <contract_artifact> <function>
|
|
10
|
+
|
|
11
|
+
Options:
|
|
12
|
+
-h, --help Print help
|
|
13
|
+
|
|
14
|
+
Will output an svg at <artifact_path>/<contract>-<function>-flamegraph.svg.
|
|
15
|
+
You can open it in your browser to view it.
|
|
16
|
+
|
|
17
|
+
EOF
|
|
18
|
+
exit 0
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
cleanup() {
|
|
22
|
+
set +e
|
|
23
|
+
if [ -f "$function_artifact" ]; then
|
|
24
|
+
rm -f "$function_artifact"
|
|
25
|
+
fi
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
trap cleanup EXIT
|
|
29
|
+
|
|
30
|
+
# Get the directory of the script
|
|
31
|
+
script_dir=$(realpath $(dirname $0))
|
|
32
|
+
|
|
33
|
+
PROFILER=${PROFILER_PATH:-noir-profiler}
|
|
34
|
+
BB=${BB:-bb}
|
|
35
|
+
|
|
36
|
+
# first console arg is contract name in camel case or path to contract artifact
|
|
37
|
+
contract=$1
|
|
38
|
+
|
|
39
|
+
# second console arg is the contract function
|
|
40
|
+
function=$2
|
|
41
|
+
|
|
42
|
+
if [ ! -f "$contract" ]; then
|
|
43
|
+
echo "Error: Contract artifact not found at: $contract"
|
|
44
|
+
exit 1
|
|
45
|
+
fi
|
|
46
|
+
artifact_path=$contract
|
|
47
|
+
function_artifact="${artifact_path%%.json}-${function}.json"
|
|
48
|
+
output_dir=$(dirname "$artifact_path")
|
|
49
|
+
|
|
50
|
+
# Extract artifact for the specific function.
|
|
51
|
+
node $script_dir/extract_function.js "$artifact_path" $function
|
|
52
|
+
|
|
53
|
+
# Generate the flamegraph
|
|
54
|
+
$PROFILER gates --artifact-path "$function_artifact" --backend-path "$BB" --backend-gates-command "gates" --output "$output_dir" --scheme chonk --include_gates_per_opcode
|
|
55
|
+
|
|
56
|
+
# Save as $artifact_name-$function-flamegraph.svg
|
|
57
|
+
output_file="${function_artifact%%.json}-flamegraph.svg"
|
|
58
|
+
mv "$output_dir/__aztec_nr_internals__${function}_gates.svg" "$output_file"
|
|
59
|
+
echo "Flamegraph generated at: $output_file"
|
package/scripts/init.sh
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
NARGO=${NARGO:-nargo}
|
|
5
|
+
script_path=$(realpath $(dirname "$0"))
|
|
6
|
+
|
|
7
|
+
for arg in "$@"; do
|
|
8
|
+
if [ "$arg" == "--help" ] || [ "$arg" == "-h" ]; then
|
|
9
|
+
cat << 'EOF'
|
|
10
|
+
Aztec Init - Create a new Aztec Noir project in the current directory
|
|
11
|
+
|
|
12
|
+
Usage: aztec init [OPTIONS]
|
|
13
|
+
|
|
14
|
+
Options:
|
|
15
|
+
--name <NAME> Name of the package [default: current directory name]
|
|
16
|
+
--lib Use a library template
|
|
17
|
+
-h, --help Print help
|
|
18
|
+
|
|
19
|
+
This command creates a new Aztec Noir project in the current directory using nargo
|
|
20
|
+
and automatically adds the Aztec.nr dependency to your Nargo.toml file.
|
|
21
|
+
|
|
22
|
+
EOF
|
|
23
|
+
exit 0
|
|
24
|
+
fi
|
|
25
|
+
if [ "$arg" == "--lib" ]; then
|
|
26
|
+
is_contract=0
|
|
27
|
+
fi
|
|
28
|
+
done
|
|
29
|
+
|
|
30
|
+
echo "Initializing Noir project..."
|
|
31
|
+
$NARGO init "$@"
|
|
32
|
+
|
|
33
|
+
if [ "${is_contract:-1}" -eq 1 ]; then
|
|
34
|
+
$script_path/setup_project.sh
|
|
35
|
+
fi
|
package/scripts/new.sh
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
NARGO=${NARGO:-nargo}
|
|
5
|
+
script_path=$(realpath $(dirname "$0"))
|
|
6
|
+
|
|
7
|
+
type_arg="--contract"
|
|
8
|
+
|
|
9
|
+
while [[ $# -gt 0 ]]; do
|
|
10
|
+
case $1 in
|
|
11
|
+
--help|-h)
|
|
12
|
+
cat << 'EOF'
|
|
13
|
+
Aztec New - Create a new Aztec Noir project in a new directory
|
|
14
|
+
|
|
15
|
+
Usage: aztec new [OPTIONS] <PATH>
|
|
16
|
+
|
|
17
|
+
Arguments:
|
|
18
|
+
<PATH> The path to save the new project
|
|
19
|
+
|
|
20
|
+
Options:
|
|
21
|
+
--name <NAME> Name of the package [default: package directory name]
|
|
22
|
+
--lib Create a library template instead of a contract
|
|
23
|
+
-h, --help Print help
|
|
24
|
+
|
|
25
|
+
This command creates a new Aztec Noir project using nargo and automatically
|
|
26
|
+
adds the Aztec.nr dependency to your Nargo.toml file.
|
|
27
|
+
EOF
|
|
28
|
+
exit 0
|
|
29
|
+
;;
|
|
30
|
+
--lib)
|
|
31
|
+
type_arg="--lib"
|
|
32
|
+
shift
|
|
33
|
+
;;
|
|
34
|
+
--name)
|
|
35
|
+
name_arg="--name $2"
|
|
36
|
+
shift 2
|
|
37
|
+
;;
|
|
38
|
+
*)
|
|
39
|
+
project_path=$1
|
|
40
|
+
shift
|
|
41
|
+
break
|
|
42
|
+
;;
|
|
43
|
+
esac
|
|
44
|
+
done
|
|
45
|
+
|
|
46
|
+
if [ -z "$project_path" ]; then
|
|
47
|
+
echo "Error: PATH argument is required"
|
|
48
|
+
echo "Usage: aztec new [OPTIONS] <PATH>"
|
|
49
|
+
echo "Run 'aztec new --help' for more information"
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
echo "Creating new Noir project at $project_path..."
|
|
54
|
+
$NARGO new $type_arg ${name_arg:-} $project_path
|
|
55
|
+
|
|
56
|
+
if [ "$type_arg" == "--contract" ]; then
|
|
57
|
+
cd $project_path
|
|
58
|
+
$script_path/setup_project.sh
|
|
59
|
+
fi
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Get the actual aztec version for the git tag.
|
|
5
|
+
AZTEC_VERSION=$(jq -r '.version' $(dirname $0)/../package.json)
|
|
6
|
+
NARGO_TOML_PATH="Nargo.toml"
|
|
7
|
+
MAIN_NR_PATH="src/main.nr"
|
|
8
|
+
|
|
9
|
+
if [ ! -f "$NARGO_TOML_PATH" ]; then
|
|
10
|
+
>&2 echo "Warning: Could not find Nargo.toml at $NARGO_TOML_PATH to add aztec dependency"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
if [ ! -f "$MAIN_NR_PATH" ]; then
|
|
15
|
+
>&2 echo "Warning: Could not find main.nr at $MAIN_NR_PATH"
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# Add aztec dependency to Nargo.toml
|
|
20
|
+
echo "" >> "$NARGO_TOML_PATH"
|
|
21
|
+
echo "aztec = { git=\"https://github.com/AztecProtocol/aztec-nr\", tag=\"v${AZTEC_VERSION}\", directory=\"aztec\" }" >> "$NARGO_TOML_PATH"
|
|
22
|
+
echo "Added aztec dependency (v${AZTEC_VERSION}) to Nargo.toml"
|
|
23
|
+
|
|
24
|
+
# Replace the contents of main.nr with the Aztec contract template
|
|
25
|
+
cat > "$MAIN_NR_PATH" << 'EOF'
|
|
26
|
+
use aztec::macros::aztec;
|
|
27
|
+
|
|
28
|
+
#[aztec]
|
|
29
|
+
contract Main {}
|
|
30
|
+
EOF
|
|
31
|
+
echo "Created main.nr with Aztec contract template"
|
package/src/cli/cli.ts
CHANGED
|
@@ -31,9 +31,10 @@ export function injectAztecCommands(program: Command, userLog: LogFn, debugLogge
|
|
|
31
31
|
|
|
32
32
|
program.configureHelp({ sortSubcommands: true });
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
if (process.env.AZTEC_SHELL_WRAPPER) {
|
|
35
|
+
program.addHelpText(
|
|
36
|
+
'after',
|
|
37
|
+
`
|
|
37
38
|
|
|
38
39
|
Additional commands:
|
|
39
40
|
|
|
@@ -64,30 +65,17 @@ export function injectAztecCommands(program: Command, userLog: LogFn, debugLogge
|
|
|
64
65
|
The compiled contracts will be placed in the target/ directory by default.
|
|
65
66
|
Supports standard nargo compile options.
|
|
66
67
|
|
|
67
|
-
fmt [options]: formats Noir code using nargo fmt
|
|
68
|
-
Example:
|
|
69
|
-
$ aztec fmt # formats all Noir files in the project
|
|
70
|
-
|
|
71
|
-
check [options]: type-checks Noir code without compiling using nargo check
|
|
72
|
-
Example:
|
|
73
|
-
$ aztec check # checks all Noir files in the project
|
|
74
|
-
|
|
75
68
|
test [options]: starts a dockerized TXE node via
|
|
76
69
|
$ aztec start --txe
|
|
77
70
|
then runs
|
|
78
71
|
$ aztec test --silence-warnings --oracle-resolver=<TXE_ADDRESS> [options]
|
|
79
72
|
|
|
80
|
-
lsp: starts the Nargo Language Server Protocol server
|
|
81
|
-
Runs nargo lsp in a Docker container for IDE integration with Noir.
|
|
82
|
-
This command is typically used by IDE extensions and not called directly by users.
|
|
83
|
-
Example:
|
|
84
|
-
$ aztec lsp # starts the LSP server
|
|
85
|
-
|
|
86
73
|
preload-crs: Downloads and caches the Common Reference String (CRS) data required for zero-knowledge proofs.
|
|
87
74
|
Example:
|
|
88
75
|
$ aztec preload-crs # preloads CRS data
|
|
89
76
|
`,
|
|
90
|
-
|
|
77
|
+
);
|
|
78
|
+
}
|
|
91
79
|
|
|
92
80
|
program
|
|
93
81
|
.command('preload-crs')
|