Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): Noir contract compiler CLI #1561

Merged
merged 6 commits into from
Aug 15, 2023
Merged

feat(cli): Noir contract compiler CLI #1561

merged 6 commits into from
Aug 15, 2023

Conversation

spalladino
Copy link
Collaborator

@spalladino spalladino commented Aug 14, 2023

Exposes a Noir contract compiler to end users via the CLI. Adds a new compile command in the aztec-cli, also exposed via the noir-compiler package as aztec-compile contract. This command compiles a noir contract using nargo or noir-wasm (defaulting to nargo until noir-lang/noir#2210 is fixed), then reformats it for Aztec consumption, and optionally generates typescript wrappers and noir interfaces. All these actions are also exported as functions from the noir-compiler package, and are now used in the copy-output script.

This PR also makes a few changes to the generated typescript type: create gets renamed to at (to make it clear we're not creating a new contract but creating an instance of the ts wrapper for a contract at an address) and the import path to the ABI is directly to the JSON file.

We could add more (sub)commands just for generating the typescript or noir interfaces from the CLI, so it can be used in flows where nargo is used directly. We should also update the project README and add a page in the docs about how to compile one's own contracts (not sure if there's already one in the skeleton).

Fixes #1457

@spalladino spalladino requested a review from sirasistant August 14, 2023 20:15
@iAmMichaelConnor
Copy link
Contributor

Please could you also write a section of the docs for how to compile a noir contract? (See list of placeholder docs pages: #1456).
Such documentation can be a separate PR, though (and even a separate person) :)
There's a getting-started/noir-contracts page - maybe a subheading and some quick instructinos for how to compile in there.
There's also a dedicated compiling page, which could contain extra, embellished information on compiling, in time for the 'public release'.

@spalladino spalladino requested a review from benesjan August 15, 2023 12:12
Copy link
Contributor

@benesjan benesjan left a comment

Choose a reason for hiding this comment

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

Very nice!

@@ -116,13 +116,13 @@ await viewUnencryptedLogs();
////////////// QUERYING THE TOKEN BALANCE FOR EACH ACCOUNT //////////////

// Create the contract abstraction and link to Alice's wallet for future signing
const tokenContractAlice = await PrivateTokenContract.create(
const tokenContractAlice = await PrivateTokenContract.at(
Copy link
Contributor

Choose a reason for hiding this comment

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

Love this change.

"rebuildPatterns": ["^circuits/cpp/barretenberg/cpp/"],
"rebuildPatterns": [
"^circuits/cpp/barretenberg/cpp/"
],
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect formatting has been annoying me for a while so I've created an issue for this.

@spalladino spalladino enabled auto-merge (squash) August 15, 2023 13:45
@spalladino spalladino merged commit 4af4845 into master Aug 15, 2023
@spalladino spalladino deleted the palla/compiler branch August 15, 2023 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Define how users will compile contracts
3 participants