feat: aztec new supporting multiple contract crates#21007
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
e2d10dd to
ed7ab74
Compare
ed7ab74 to
b580bee
Compare
d00e24e to
13ee959
Compare
nchamo
left a comment
There was a problem hiding this comment.
Great work, just left a few comments
| name_arg="$2" | ||
| shift 2 | ||
| ;; | ||
| *) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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


Summary
aztec newpreviously created a workspace with fixed crate directories namedcontract/andtest/. 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:
aztec new countercreatescounter_contract/andcounter_test/instead ofcontract/andtest/.aztec newsupports adding contracts to an existing workspace: when run inside a directory that already has aNargo.tomlwith[workspace], it adds a new contract+test crate pair and appends the members to the workspace manifest.add_crate.shscript: extracted the crate-creation logic fromsetup_workspace.shinto a reusableadd_crate.shso it can be called both during initial setup and when adding subsequent contracts.setup_workspace.shsimplified: now just creates the workspace rootNargo.tomlwith empty members and delegates toadd_crate.sh.counter_contractdirectory undernoir-projects/noir-contracts/contracts/test/is restructured fromcounter_contract/{contract,test}tocounter/{counter_contract,counter_test}to match the new naming convention.generate-types.shfor bothnoir-contracts.jsandnoir-test-contracts.jsare 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 contractaztec-up/test/counter_contract.sh— verifies the counter contract compiles and codegens with the new directory layoutNargo.toml)🤖 Generated with Claude Code
Closes https://linear.app/aztec-labs/issue/F-373/make-aztec-newinit-handle-multiple-contract-crates-within-one