-
Notifications
You must be signed in to change notification settings - Fork 615
docs: add versions section to updating doc #4916
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
Changes from 4 commits
8b62603
561e75c
23cc094
4845b89
23c5789
09d7309
f4255b7
e622bea
38ce9ae
eb97f10
178fd0e
1327851
fc85794
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,130 @@ | ||||||||
| --- | ||||||||
| title: Versions and Updating | ||||||||
| --- | ||||||||
|
|
||||||||
|
|
||||||||
| ## Versions | ||||||||
| Aztec tools (sandbox, cli, nargo), dependencies (aztec-nr), and sample contracts are constantly being improved. | ||||||||
| When developing and referring to example .nr files/snippets, it is helpful to verify the versions of different components (below), and if required keep them in lock-step by [updating](#updating). | ||||||||
|
|
||||||||
| ### Checking tool versions | ||||||||
| To check your version of Aztec tools, you can use `aztec-cli -V` | ||||||||
| ::note | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| The `aztec-nargo` versions follow `nargo` versions, which is different to the Aztec tool versions. | ||||||||
| ::note | ||||||||
| The latest version of the Aztec tooling is currently `#include_aztec_version` , updating roughly every week. | ||||||||
|
|
||||||||
| ### Dependency versions | ||||||||
| Dependency versions in a contract's `Nargo.toml` file correspond to the `aztec-packages` repository tag `aztec-packages` (filter tags by `aztec`...) | ||||||||
|
|
||||||||
| If you get an error like: `Cannot read file ~/nargo/github.com/AztecProtocol/aztec-packages/...` | ||||||||
| Check the `git=` github url, tag, and directory. | ||||||||
| :::note | ||||||||
| The folder structure changed at **0.24.0** from `yarn-project/aztec-nr` to `noir-projects/aztec-nr`. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is mentioned in the migration notes page. Consider linking there to reduce redundant information. Any developers coming after v0.24 don't need to see this
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could remove all of the following lines until |
||||||||
| :::note | ||||||||
|
|
||||||||
| That is, BEFORE `aztec-packages-v0.24.0`: | ||||||||
| `aztec = { git="https://github.com/AztecProtocol/aztec-packages/", tag="aztec-packages-v0.23.0", directory="yarn-project/aztec-nr/aztec" }` | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. formatting got weird because the suggestion is delineated with three back ticks |
||||||||
| At/after `aztec-packages-v0.24.0`: | ||||||||
| `aztec = { git="https://github.com/AztecProtocol/aztec-packages/", tag="aztec-packages-v0.24.0", directory="noir-projects/aztec-nr/aztec" }` | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
|
||||||||
| ### Example contract versions | ||||||||
| Example contracts serve as an especially helpful reference between versions of the aztec-nr framework. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
|
||||||||
| Code referenced in the documentation is sourced from a directory in the `aztec-packages` repository. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe link directly to this directory, since you mention it. |
||||||||
| As in the previous section, the location of the noir contracts moved at version `0.24.0`, from `yarn-project/noir-contracts` before, to `noir-projects/noir-contracts`. | ||||||||
|
|
||||||||
| :::tip | ||||||||
| Notice the difference between the sample Counter contract from `0.23.0` to `0.24.0` shows the `note_type_id` was added. | ||||||||
| `diff ~/nargo/github.com/AztecProtocol/aztec-packages-v0.23.0/yarn-project/noir-contracts/contracts/counter_contract/src/main.nr ~/nargo/github.com/AztecProtocol/aztec-packages-v0.24.0/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr ` | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make this a code block instead of just code formatted. and maybe an indicator that it is a shell command |
||||||||
| ``` | ||||||||
| 57a58 | ||||||||
| > note_type_id: Field, | ||||||||
| ``` | ||||||||
| :::tip | ||||||||
|
|
||||||||
| ### Language server version (nargo) | ||||||||
| The [Noir LSP](https://docs.aztec.network/developers/contracts/main#install-noir-lsp-recommended) uses your local version of `aztec-nargo`, and thus also `aztec-nargo compile`. | ||||||||
|
critesjosh marked this conversation as resolved.
|
||||||||
| The path of the former (once installed) can be seen by hovering over "Nargo" in the bottom status bar, and the latter via `which aztec-nargo`. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
|
||||||||
| This can present confusion when opening older noir contracts (and dependencies), such as: | ||||||||
| - Logs filled with errors from the dependencies | ||||||||
| - Or the LSP fails (re-runs automatically then stops) | ||||||||
| The second point requires a restart of the extension. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
|
||||||||
| :::tip | ||||||||
| When using the LSP in VSCode, reference older versions of Noir code in a separate window or a browser. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does a separate window help? Doesn't the LSP always use locally installed version of nargo?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you're using the correct version of aztec-nargo with the correct version of your code, all is well. If you happen to open an older versioned contract, and unlucky to hit some error with aztec-nargo and that code version, then vscode will try rerun the extension. This happens 5 times before the extension decides to stop trying. To prevent this scenario the suggestion is to keep your primary window pure, and reference the old code elsewhere. If in another vscode window (not tab), the main window's extension is fine. Happy to drop this since the "tip" tag is overly prominent for this minor/low-probability devexp optimisation. |
||||||||
| :::tip | ||||||||
|
|
||||||||
| ## Updating | ||||||||
| ### TL;DR | ||||||||
|
|
||||||||
| 1. Updating the sandbox and CLI: | ||||||||
|
|
||||||||
| ```shell | ||||||||
| aztec-up | ||||||||
| ``` | ||||||||
|
|
||||||||
| 2. Updating aztec-nr and individual @aztec dependencies: | ||||||||
|
|
||||||||
| Inside your project run: | ||||||||
|
|
||||||||
| ```shell | ||||||||
| cd your/aztec/project | ||||||||
| aztec-cli update . --contract src/contract1 --contract src/contract2 | ||||||||
| ``` | ||||||||
|
|
||||||||
| The sandbox must be running for the update command to work. Make sure it is [installed and running](../developers/sandbox/references/sandbox-reference.md). | ||||||||
|
|
||||||||
| 3. Refer [Migration Notes](../misc/migration_notes.md) on any breaking changes that might affect your dapp | ||||||||
|
|
||||||||
| --- | ||||||||
|
|
||||||||
| There are four components whose versions need to be kept compatible: | ||||||||
|
|
||||||||
| 1. Aztec Sandbox | ||||||||
| 2. Aztec CLI | ||||||||
| 3. aztec-nargo | ||||||||
| 4. `Aztec.nr`, the Noir framework for writing Aztec contracts | ||||||||
|
|
||||||||
| First three are packaged together in docker and are kept compatible by running `aztec-up`. | ||||||||
| But you need to update your Aztec.nr version manually or using `aztec-cli update`. | ||||||||
|
|
||||||||
| ## Updating Aztec.nr packages | ||||||||
|
|
||||||||
| ### Automatic update | ||||||||
|
|
||||||||
| `aztec-cli` will update your Aztec.nr packages to the appropriate version with the `aztec-cli update` command. Run this command from the root of your project and pass the paths to the folders containing the Nargo.toml files for your projects like so: | ||||||||
|
|
||||||||
| ```shell | ||||||||
| aztec-cli update . --contract src/contract1 --contract src/contract2 | ||||||||
| ``` | ||||||||
|
|
||||||||
| ### Manual update | ||||||||
|
|
||||||||
| To update the aztec.nr packages manually, update the tags of the `aztec.nr` dependencies in the `Nargo.toml` file. | ||||||||
|
|
||||||||
| ```diff | ||||||||
| [dependencies] | ||||||||
| -aztec = { git="https://github.com/AztecProtocol/aztec-packages", tag="aztec-packages-v0.7.5", directory="noir-projects/aztec-nr/aztec" } | ||||||||
| +aztec = { git="https://github.com/AztecProtocol/aztec-packages", tag="#include_aztec_version", directory="noir-projects/aztec-nr/aztec" } | ||||||||
|
signorecello marked this conversation as resolved.
|
||||||||
| -value_note = { git="https://github.com/AztecProtocol/aztec-packages", tag="aztec-packages-v0.7.5", directory="noir-projects/aztec-nr/value-note" } | ||||||||
| +value_note = { git="https://github.com/AztecProtocol/aztec-packages", tag="#include_aztec_version", directory="noir-projects/aztec-nr/value-note" } | ||||||||
| ``` | ||||||||
|
|
||||||||
| Go to the contract directory and try compiling it with `aztec-nargo compile` to verify that the update was successful: | ||||||||
|
|
||||||||
| ```shell | ||||||||
| cd /your/contract/directory | ||||||||
| aztec-nargo compile | ||||||||
| ``` | ||||||||
|
|
||||||||
| If the dependencies fail to resolve ensure that the tag matches a tag in the [aztec-packages repository](https://github.com/AztecProtocol/aztec-packages/tags). | ||||||||
|
signorecello marked this conversation as resolved.
|
||||||||
|
|
||||||||
| ## Updating `aztec-nargo` | ||||||||
|
|
||||||||
| `aztec-nargo` is updated by running: | ||||||||
|
|
||||||||
| ```bash | ||||||||
| aztec-up | ||||||||
| ``` | ||||||||
Uh oh!
There was an error while loading. Please reload this page.