Skip to content

feat: aztec new supporting multiple contract crates#21007

Merged
benesjan merged 6 commits intomerge-train/fairiesfrom
03-02-feat_aztec_new_supporting_multiple_contract_crates
Mar 4, 2026
Merged

feat: aztec new supporting multiple contract crates#21007
benesjan merged 6 commits intomerge-train/fairiesfrom
03-02-feat_aztec_new_supporting_multiple_contract_crates

Conversation

@benesjan
Copy link
Contributor

@benesjan benesjan commented Mar 2, 2026

Summary

aztec new previously created a workspace with fixed crate directories named contract/ and test/. This made it impossible to add a second contract to the same workspace, since the directory names would collide.

This PR restructures the scaffold so that:

  • Crate directories are named after the contract: aztec new counter creates counter_contract/ and counter_test/ instead of contract/ and test/.
  • aztec new supports adding contracts to an existing workspace: when run inside a directory that already has a Nargo.toml with [workspace], it adds a new contract+test crate pair and appends the members to the workspace manifest.
  • New add_crate.sh script: extracted the crate-creation logic from setup_workspace.sh into a reusable add_crate.sh so it can be called both during initial setup and when adding subsequent contracts.
  • setup_workspace.sh simplified: now just creates the workspace root Nargo.toml with empty members and delegates to add_crate.sh.
  • Counter contract test fixture updated: the counter_contract directory under noir-projects/noir-contracts/contracts/test/ is restructured from counter_contract/{contract,test} to counter/{counter_contract,counter_test} to match the new naming convention.
  • Type generation scripts updated: the sed patterns in generate-types.sh for both noir-contracts.js and noir-test-contracts.js are adjusted to handle the new deeper directory nesting.

Test plan

  • aztec-up/test/default_scaffold.sh — verifies creating a new workspace and adding a second contract
  • aztec-up/test/counter_contract.sh — verifies the counter contract compiles and codegens with the new directory layout
  • Existing noir-contracts compilation (workspace member paths updated in Nargo.toml)

🤖 Generated with Claude Code

Closes https://linear.app/aztec-labs/issue/F-373/make-aztec-newinit-handle-multiple-contract-crates-within-one

Copy link
Contributor Author

benesjan commented Mar 2, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@benesjan benesjan force-pushed the 03-02-feat_aztec_new_supporting_multiple_contract_crates branch from e2d10dd to ed7ab74 Compare March 3, 2026 02:06
@benesjan benesjan force-pushed the 03-02-feat_aztec_new_supporting_multiple_contract_crates branch from ed7ab74 to b580bee Compare March 3, 2026 02:29
@benesjan benesjan force-pushed the 03-02-feat_aztec_new_supporting_multiple_contract_crates branch from d00e24e to 13ee959 Compare March 3, 2026 04:42
@benesjan benesjan marked this pull request as ready for review March 3, 2026 04:44
@benesjan benesjan requested a review from charlielye as a code owner March 3, 2026 04:44
@benesjan benesjan requested review from nchamo and removed request for charlielye March 3, 2026 04:44
Copy link
Contributor

@nchamo nchamo left a comment

Choose a reason for hiding this comment

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

Great work, just left a few comments

name_arg="$2"
shift 2
;;
*)
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct me if I'm wrong because bash is not my strong suit, but wouldn't this cause
aztec new counter --name foo to use the name "foo" for the contract?
Should we fail for now unknown params?

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 don't follow. --name has been dropped so it's now irrelevant

The command creates a contract crate called foo_contract in workspace foo.

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant that since we were allowing unknown commands, only the last word would be considered the project name. Reading it back, I wasn't clear at all

Copy link
Contributor Author

@benesjan benesjan Mar 4, 2026

Choose a reason for hiding this comment

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

I also don't understand bash but AI seems to have done it correctly 🤣

image

@benesjan benesjan requested a review from nchamo March 4, 2026 10:03
Copy link
Contributor

@nchamo nchamo left a comment

Choose a reason for hiding this comment

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

Great work @benesjan !

You are making really good QoL improvements

@benesjan benesjan merged commit 1282ec1 into merge-train/fairies Mar 4, 2026
11 checks passed
@benesjan benesjan deleted the 03-02-feat_aztec_new_supporting_multiple_contract_crates branch March 4, 2026 13:12
github-merge-queue bot pushed a commit that referenced this pull request Mar 5, 2026
BEGIN_COMMIT_OVERRIDE
chore: remove prefund env var in non local networks (#21095)
feat: aztec new supporting multiple contract crates (#21007)
feat!: Expose offchain effects when simulating/sending txs (#20563)
chore: exclude auto-generated dirs from VS Code search (#20881)
feat: improve oracle name prefixes (#21101)
fix(pxe): correct contract class log DA gas metering from +2 to +1
(#21102)
chore: remove stale aes comments (#21133)
chore: add warning on invalid recipients (#21134)
feat: mask ciphertext fields with Poseidon2-derived values (#21009)
END_COMMIT_OVERRIDE
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.

2 participants