Skip to content

refactor!: new aztec command#17792

Merged
benesjan merged 1 commit intonextfrom
10-17-refactor_moving_atec-nargo_init_to_aztec
Nov 8, 2025
Merged

refactor!: new aztec command#17792
benesjan merged 1 commit intonextfrom
10-17-refactor_moving_atec-nargo_init_to_aztec

Conversation

@benesjan
Copy link
Contributor

@benesjan benesjan commented Oct 17, 2025

The title of the PR is vague because there is a lot of changes in this PR.

Other than tackling these issues here:

Closes https://linear.app/aztec-labs/issue/F-41/replace-aztec-nargo-init-with-aztec-init
Closes https://linear.app/aztec-labs/issue/F-43/replace-aztec-nargo-compile-with-aztec-compile
Closes https://linear.app/aztec-labs/issue/F-44/aztec-compile-help-will-override-the-nargo-compile-help-with-aztec
Closes https://linear.app/aztec-labs/issue/F-48/add-aztec-check-and-aztec-fmt

I also:

  • Added aztec new command that is like aztec init but instead calls nargo new. This was necessary as we used aztec-nargo new in docs etc. Hence I needed the aztec new counterpart.
  • I dropped the aztec-postprocess-contract directory containing the transpile_contract_and_gen_vks.sh script because it now only called the aztec_process command in bb which made this basically a tech debt from time where we forced devs to call this script manually.
  • Went to occurrences of "aztec-nargo" and "aztec-postprocess-contract" strings in the codebase and docs and did the relevant updates.
  • I replace the default contract template that nargo init --contract and nargo new --contract commands spit out with:
use aztec::macros::aztec;

#[aztec]
contract Main {}

This results in the aztec-nargo and aztec-postprocess-contract being deprecated (and deleted).

Thought it's fine to do all these changes in one PR because the complexity of the changes is low.

@benesjan benesjan changed the title refactor: moving atec-nargo init to aztec refactor! dropping aztec-nargo Oct 27, 2025
@benesjan benesjan force-pushed the 10-17-refactor_moving_atec-nargo_init_to_aztec branch from e7bc033 to e31046b Compare October 27, 2025 18:09
Comment on lines -59 to -60
# Should this just be aztec-test? It's like, a new command that doesn't exist on aztec cli.
# Or just make this a first class command on aztec cli?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was no longer relevant - now we know we want aztec test.

@@ -1,25 +0,0 @@
#!/usr/bin/env bash
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aztec compile handles this automatically so no need to have a separate command.

@benesjan benesjan force-pushed the 10-17-refactor_moving_atec-nargo_init_to_aztec branch from 7b961e4 to 7bcf731 Compare October 29, 2025 15:05
Comment on lines +310 to +312
# Note: I allow devs to use the `aztec` command to also create bin and lib projects because we currently rely
# on the dockerized nargo and I am not sure if it's expected they will have a native nargo on path. If we decide
# to use native nargo I think we can just hardcode --contract here and not bother with the other options.
Copy link
Contributor Author

@benesjan benesjan Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation of the new command is basically the same as init but I didn't bother reusing the code here as the complexity is low and this comment might make me change quite a few things here.

Feel like the design choice of allowing devs to also create bin and lib project with aztec command is controversial so please chime in if you disagree with the choice.

Comment on lines +86 to +88
preload-crs: Downloads and caches the Common Reference String (CRS) data required for zero-knowledge proofs.
Example:
$ aztec preload-crs # preloads CRS data
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated to the PR - it was undocumented here and AI added it here when updating the docs.

@benesjan benesjan changed the title refactor! dropping aztec-nargo refactor! merging aztec-nargo and aztec-postprocess-contract to aztec Oct 29, 2025
@benesjan benesjan marked this pull request as ready for review October 29, 2025 17:37
@benesjan benesjan requested a review from charlielye as a code owner October 29, 2025 17:37
$DOCKER_REPO:$VERSION "$@"
}

function setup_aztec_contract_project {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this function and parse_project_flags_and_build_nargo_args because the functionality is shared between nargo new and nargo init commands.

Comment on lines +147 to +162
--lib)
NARGO_ARGS+=("--lib")
HAS_TYPE_FLAG=true
shift
;;
--bin)
NARGO_ARGS+=("--bin")
HAS_TYPE_FLAG=true
shift
;;
--contract)
NARGO_ARGS+=("--contract")
HAS_TYPE_FLAG=true
IS_CONTRACT=true
shift
;;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I allow devs to use the aztec command to also create bin and lib projects because we currently rely on the dockerized nargo and I am not sure if it's expected they will have a native nargo on path. If we decide to use native nargo I think we can just hardcode --contract here and not bother with the other options.

I think this is quite a controversial decision so if the reviewer disagrees LMK.

Comment on lines +533 to +548
lsp)
# TODO: Drop this (and the corresponding docs in cli.ts) in case `nargo` is to be used natively (not containerized).

# Special-case nargo's LSP command:
# 1. include --rm for cleanup
# 2. don't specify a user (run as root)
# 3. don't specify a workdir
validate_working_directory

docker run --rm -i \
--name aztec-nargo-lsp \
-v $HOME:$HOME \
-e HOME=$HOME \
--entrypoint=/usr/src/noir/noir-repo/target/release/nargo \
$DOCKER_REPO:$VERSION lsp
;;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a copy-paste from the original aztec-nargo command. Might be dropped in the future if it's decided we don't want to use containerized nargo.

@benesjan benesjan changed the title refactor! merging aztec-nargo and aztec-postprocess-contract to aztec refactor!: new aztec command Oct 29, 2025
@benesjan benesjan marked this pull request as draft October 29, 2025 18:35
@benesjan benesjan force-pushed the 10-17-refactor_moving_atec-nargo_init_to_aztec branch from 4ef46de to 1cdec92 Compare October 29, 2025 18:36
@benesjan benesjan marked this pull request as ready for review October 29, 2025 19:09
"compile": "cd src/contracts && ${AZTEC_NARGO:-aztec-nargo} compile --silence-warnings && ${AZTEC_POSTPROCESS_CONTRACT:-aztec-postprocess-contract}",
"codegen": "${AZTEC_BUILDER:-aztec} codegen src/contracts/target -o artifacts",
"compile": "cd src/contracts && ${AZTEC:-aztec} compile --silence-warnings",
"codegen": "${AZTEC:-aztec} codegen src/contracts/target -o artifacts",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The codegen command is also exposed on aztec directly so I used it here.

Think it might make sense to just drop the builder cli and have the functionality exposed just on the aztec command but that's out of scope of this PR.

Comment on lines -6 to -11
export TRANSPILER=$PWD/../avm-transpiler/target/release/avm-transpiler
export BB=$PWD/../barretenberg/cpp/build/bin/bb
export NARGO=$PWD/../noir/noir-repo/target/release/nargo
export AZTEC_NARGO=$PWD/../aztec-up/bin/aztec-nargo
export AZTEC_POSTPROCESS_CONTRACT=$PWD/../aztec-up/bin/aztec-postprocess-contract
export AZTEC_BUILDER=$PWD/../yarn-project/builder/aztec-builder-dest
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were stale and not used so I dropped it.

@benesjan benesjan requested review from Thunkar and nventuro October 29, 2025 20:11
@benesjan benesjan force-pushed the 10-17-refactor_moving_atec-nargo_init_to_aztec branch 3 times, most recently from eab3a42 to b0bd5bd Compare November 4, 2025 19:03
@AztecBot
Copy link
Collaborator

AztecBot commented Nov 4, 2025

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033[38;2;188;109;208mFLAKED\033[0m (\033[38;2;250;217;121m8;;http://ci.aztec-labs.com/202340680d53f95f�202340680d53f95f8;;�\033[0m): BOX=react BROWSER=firefox run_compose_test react-firefox box boxes (68s) (code: 1) (\033[38;2;188;109;208mJan Beneš\033[0m: refactor!: new `aztec` command (#17792))

@benesjan benesjan force-pushed the 10-17-refactor_moving_atec-nargo_init_to_aztec branch 2 times, most recently from 7ff9178 to 80e26bf Compare November 6, 2025 14:42
@benesjan benesjan force-pushed the 10-17-refactor_moving_atec-nargo_init_to_aztec branch from 80e26bf to 2102b17 Compare November 6, 2025 22:00
@benesjan benesjan force-pushed the 10-17-refactor_moving_atec-nargo_init_to_aztec branch from 2102b17 to 69a40c3 Compare November 7, 2025 20:21
Copy link
Contributor

@nventuro nventuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Reading bash breaks my brain but the functionality seems to be there. If we find small issues here we can address them as we go.

@benesjan benesjan enabled auto-merge November 7, 2025 21:30
@benesjan benesjan force-pushed the 10-17-refactor_moving_atec-nargo_init_to_aztec branch from 69a40c3 to c263145 Compare November 8, 2025 22:18
The title of the PR is vague because there is a lot of changes in this PR.

Other than tackling these issues here:

Closes https://linear.app/aztec-labs/issue/F-41/replace-aztec-nargo-init-with-aztec-init
Closes https://linear.app/aztec-labs/issue/F-43/replace-aztec-nargo-compile-with-aztec-compile
Closes https://linear.app/aztec-labs/issue/F-44/aztec-compile-help-will-override-the-nargo-compile-help-with-aztec
Closes https://linear.app/aztec-labs/issue/F-48/add-aztec-check-and-aztec-fmt

I also:
- Added `aztec new` command that is like `aztec init` but instead calls `nargo new`. This was necessary as we used `aztec-nargo new` in docs etc. Hence I needed the `aztec new counterpart`.
- I dropped the `aztec-postprocess-contract` directory containing the `transpile_contract_and_gen_vks.sh` script because it now only called the aztec_process command in bb which made this basically a tech debt from time where we forced devs to call this script manually.
- Went to occurrences of "aztec-nargo" and "aztec-postprocess-contract" strings in the codebase and docs and did the relevant updates.
- I replace the default contract template that `nargo init --contract` and `nargo new --contract` commands spit out with:

```
use aztec::macros::aztec;

#[aztec]
contract Main {}
```

This results in the `aztec-nargo` and `aztec-postprocess-contract` being deprecated (and deleted).

Thought it's fine to do all these changes in one PR because the complexity of the changes is low.
@AztecBot AztecBot force-pushed the 10-17-refactor_moving_atec-nargo_init_to_aztec branch from c263145 to 1e6a6a6 Compare November 8, 2025 22:38
@benesjan benesjan added this pull request to the merge queue Nov 8, 2025
Merged via the queue into next with commit 8988499 Nov 8, 2025
15 checks passed
@benesjan benesjan deleted the 10-17-refactor_moving_atec-nargo_init_to_aztec branch November 8, 2025 23:11
ludamad pushed a commit that referenced this pull request Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants