Skip to content

Commit 060f39a

Browse files
signorecellocritesjoshrahul-kothari
authored
chore(docs): starting a migration notes section (AztecProtocol#3853)
At the request of many families (I guess this portuguese expression isn't really translatable)... we're replicating the "migration notes" section in Noir docs to help devs keep track of breaking changes --------- Co-authored-by: José Pedro Sousa <github@zepedro.me> Co-authored-by: Josh Crites <jc@joshcrites.com> Co-authored-by: Rahul Kothari <rahul.kothari.201@gmail.com>
1 parent f5a4a78 commit 060f39a

File tree

3 files changed

+117
-1
lines changed

3 files changed

+117
-1
lines changed

docs/docs/dev_docs/updating.md

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ aztec-cli update . --contract src/contract1 --contract src/contract2
4343

4444
The sandbox must be running for the update command to work.
4545

46+
3. Refer [Migration Notes](../misc/migration_notes.md) on any breaking changes that might affect your dapp
4647
---
4748

4849
There are three components whose versions need to be kept compatible:

docs/docs/misc/migration_notes.md

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
title: Migration notes
3+
description: Read about migration notes from previous versions, which could solve problems while updating
4+
keywords: [sandbox, cli, aztec, notes, migration, updating, upgrading]
5+
---
6+
7+
Aztec is in full-speed development. Literally every version breaks compatibility with the previous ones. This page attempts to target errors and difficulties you might encounter when upgrading, and how to resolve them.
8+
9+
## 0.17.0
10+
11+
### [js] New `@aztec/accounts` package
12+
13+
Before:
14+
15+
```js
16+
import { getSchnorrAccount } from "@aztec/aztec.js" // previously you would get the default accounts from the `aztec.js` package:
17+
```
18+
19+
Now, import them from the new package `@aztec/accounts`
20+
21+
```js
22+
import { getSchnorrAccount } from "@aztec/accounts"
23+
```
24+
25+
### Typed Addresses
26+
Address fields in Aztec.nr now is of type `AztecAddress` as opposed to `Field`
27+
28+
Before:
29+
```rust
30+
unconstrained fn compute_note_hash_and_nullifier(contract_address: Field, nonce: Field, storage_slot: Field, serialized_note: [Field; VALUE_NOTE_LEN]) -> [Field; 4] {
31+
let note_header = NoteHeader::new(_address, nonce, storage_slot);
32+
...
33+
```
34+
35+
Now:
36+
```rust
37+
unconstrained fn compute_note_hash_and_nullifier(
38+
contract_address: AztecAddress,
39+
nonce: Field,
40+
storage_slot: Field,
41+
serialized_note: [Field; VALUE_NOTE_LEN]
42+
) -> pub [Field; 4] {
43+
let note_header = NoteHeader::new(contract_address, nonce, storage_slot);
44+
```
45+
46+
Similarly, there are changes when using aztec.js to call functions.
47+
48+
To parse a `AztecAddress` to BigInt, use `.inner`
49+
Before:
50+
```js
51+
const tokenBigInt = await bridge.methods.token().view()
52+
```
53+
54+
Now:
55+
```js
56+
const tokenBigInt = (await bridge.methods.token().view()).inner
57+
```
58+
59+
### [Aztec.nr] Add `protocol_types` to Nargo.toml
60+
```toml
61+
aztec = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/aztec-nr/aztec" }
62+
protocol_types = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/noir-protocol-circuits/src/crates/types"}
63+
```
64+
65+
### [Aztec.nr] moving compute_address func to AztecAddress
66+
Before:
67+
```rust
68+
let calculated_address = compute_address(pub_key_x, pub_key_y, partial_address);
69+
```
70+
71+
Now:
72+
```rust
73+
let calculated_address = AztecAddress::compute(pub_key_x, pub_key_y, partial_address);
74+
```
75+
76+
### [Aztec.nr] moving `compute_selector` to FunctionSelector
77+
Before:
78+
```rust
79+
let selector = compute_selector("_initialize((Field))");
80+
```
81+
82+
Now:
83+
```rust
84+
let selector = FunctionSelector::from_signature("_initialize((Field))");
85+
```
86+
87+
### [js] Importing contracts in JS
88+
89+
Contracts are now imported from a file with the type's name.
90+
91+
Before:
92+
```js
93+
import { TokenContract } from "@aztec/noir-contracts/types";
94+
```
95+
96+
Now:
97+
```js
98+
import { TokenContract } from "@aztec/noir-contracts/Token";
99+
```
100+
101+
### [Aztec.nr] Aztec example contracts location change in Nargo.toml
102+
103+
Aztec contracts are now moved outside of the `src` folder, so you need to update your imports.
104+
105+
Before:
106+
```rust
107+
easy_private_token_contract = {git = "https://github.com/AztecProtocol/aztec-packages/", tag ="v0.16.9", directory = "yarn-project/noir-contracts/src/contracts/easy_private_token_contract"}
108+
```
109+
110+
Now, just remove the `src` folder,:
111+
112+
```rust
113+
easy_private_token_contract = {git = "https://github.com/AztecProtocol/aztec-packages/", tag ="v0.17.0", directory = "yarn-project/noir-contracts/contracts/easy_private_token_contract"}
114+
```
115+

docs/sidebars.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ const sidebars = {
479479
value: "Miscellaneous",
480480
defaultStyle: true,
481481
},
482-
482+
"misc/migration_notes",
483483
"misc/glossary",
484484

485485
{

0 commit comments

Comments
 (0)