You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/developers/guides/smart_contracts/advanced/common_patterns.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,7 @@ In this situation, try to mark the public function as `internal`. This ensures y
75
75
76
76
### Moving public data into the private domain
77
77
78
-
See [partial notes](../../../../aztec/concepts/advanced/storage/partial_notes.md). Partial notes are how public balances are transferred to private [in the NFT contract](../../../tutorials/codealong/contract_tutorials/nft_contract.md).
78
+
See [partial notes](../../../../aztec/concepts/advanced/storage/partial_notes.md). Partial notes are how public balances are transferred to private [in the NFT contract](../../../tutorials/contract_tutorials/nft_contract.md).
79
79
80
80
### Discovering my notes
81
81
@@ -110,7 +110,7 @@ Hence, it's necessary to add a "randomness" field to your note to prevent such a
110
110
111
111
### L1 -- L2 interactions
112
112
113
-
Refer to [Token Portal codealong tutorial on bridging tokens between L1 and L2](../../../tutorials/codealong/js_tutorials/token_bridge.md) and/or [Uniswap smart contract example that shows how to swap on L1 using funds on L2](../../../tutorials/codealong/js_tutorials/uniswap/index.md). Both examples show how to:
113
+
Refer to [Token Portal codealong tutorial on bridging tokens between L1 and L2](../../../tutorials/js_tutorials/token_bridge.md) and/or [Uniswap smart contract example that shows how to swap on L1 using funds on L2](../../../tutorials/js_tutorials/uniswap/index.md). Both examples show how to:
114
114
115
115
1. L1 -> L2 message flow
116
116
2. L2 -> L1 message flow
@@ -124,7 +124,7 @@ To send a note to someone, they need to have a key which we can encrypt the note
124
124
There are several patterns here:
125
125
126
126
1. Give the contract a key and share it amongst all participants. This leaks privacy, as anyone can see all the notes in the contract.
127
-
2.`transfer_to_public` funds into the contract - this is used in the [Uniswap smart contract example where a user sends private funds into a Uniswap Portal contract which eventually withdraws to L1 to swap on L1 Uniswap](../../../tutorials/codealong/js_tutorials/uniswap/index.md). This works like Ethereum - to achieve contract composability, you move funds into the public domain. This way the contract doesn't even need keys.
127
+
2.`transfer_to_public` funds into the contract - this is used in the [Uniswap smart contract example where a user sends private funds into a Uniswap Portal contract which eventually withdraws to L1 to swap on L1 Uniswap](../../../tutorials/js_tutorials/uniswap/index.md). This works like Ethereum - to achieve contract composability, you move funds into the public domain. This way the contract doesn't even need keys.
128
128
129
129
There are several other designs we are discussing through [in this discourse post](https://discourse.aztec.network/t/how-to-handle-private-escrows-between-two-parties/2440) but they need some changes in the protocol or in our demo contract. If you are interested in this discussion, please participate in the discourse post!
Copy file name to clipboardExpand all lines: docs/docs/developers/guides/smart_contracts/cross_chain_communication.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,7 +94,7 @@ Note that while the `secret` and the `content` are both hashed, they are actuall
94
94
95
95
### Token bridge example
96
96
97
-
Computing the `content` must currently be done manually, as we are still adding a number of bytes utilities. A good example exists within the [Token bridge example (codealong tutorial)](../../tutorials/codealong/js_tutorials/token_bridge.md).
97
+
Computing the `content` must currently be done manually, as we are still adding a number of bytes utilities. A good example exists within the [Token bridge example (codealong tutorial)](../../tutorials/js_tutorials/token_bridge.md).
@@ -239,4 +239,4 @@ Designated callers are enforced at the contract level for contracts that are not
239
239
240
240
## Further reading
241
241
242
-
Follow the [token bridge tutorial](../../tutorials/codealong/js_tutorials/token_bridge.md) for hands-on experience writing and deploying a Portal contract.
242
+
Follow the [token bridge tutorial](../../tutorials/js_tutorials/token_bridge.md) for hands-on experience writing and deploying a Portal contract.
Note the total gate count at the bottom of the image. The image is interactive; you can hover over different parts of the graph to see the full function name of the execution step and its gate count. This tool also provides insight into the low-level operations that are performed in the private function. Don't worry about the details of the internals of the function right now, just be aware that the more complex the function, the more gates it will use and try out the flamegraph tool on your own functions.
165
165
166
-
Read more about [profiling transactions with the flamegraph tool](../../../guides/smart_contracts/advanced/profiling_transactions.md).
166
+
Read more about [profiling transactions with the flamegraph tool](../../guides/smart_contracts/advanced/profiling_transactions.md).
167
167
168
168
For more information about writing efficient private functions, see [this page](https://noir-lang.org/docs/explainers/explainer-writing-noir) of the Noir documentation.
Copy file name to clipboardExpand all lines: docs/docs/developers/tutorials/contract_tutorials/nft_contract.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -174,7 +174,7 @@ Below the dependencies, paste the following Storage struct:
174
174
175
175
## Custom Notes
176
176
177
-
The contract storage uses a [custom note](../../../guides/smart_contracts/note_types.md) implementation. Custom notes are useful for defining your own data types. You can think of a custom note as a "chunk" of private data, the entire thing is added, updated or nullified (deleted) together. This NFT note is very simple and stores only the owner and the `token_id` and uses `randomness` to hide its contents.
177
+
The contract storage uses a [custom note](../../guides/smart_contracts/note_types.md) implementation. Custom notes are useful for defining your own data types. You can think of a custom note as a "chunk" of private data, the entire thing is added, updated or nullified (deleted) together. This NFT note is very simple and stores only the owner and the `token_id` and uses `randomness` to hide its contents.
178
178
179
179
Randomness is required because notes are stored as commitments (hashes) in the note hash tree. Without randomness, the contents of a note may be derived through brute force (e.g. without randomness, if you know my Aztec address, you may be able to figure out which note hash in the tree is mine by hashing my address with many potential `token_id`s).
Copy file name to clipboardExpand all lines: docs/versioned_docs/version-v1.2.0/developers/guides/smart_contracts/writing_contracts/common_patterns/index.md
+32-18Lines changed: 32 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,31 +17,45 @@ Similarly we have discovered some anti-patterns too (like privacy leakage) that
17
17
We call this the "authentication witness" pattern or authwit for short.
Here you approve someone to transfer funds publicly on your behalf
47
61
@@ -51,7 +65,7 @@ E.g. you don't want a user to subscribe once they have subscribed already. Or yo
51
65
52
66
Emit a nullifier in your function. By adding this nullifier into the tree, you prevent another nullifier from being added again. This is also why in authwit, we emit a nullifier, to prevent someone from reusing their approval.
Note be careful to ensure that the nullifier is not deterministic and that no one could do a preimage analysis attack. More in [the anti pattern section on deterministic nullifiers](#deterministic-nullifiers)
74
88
@@ -124,7 +138,7 @@ When you send someone a note, the note hash gets added to the note hash tree. To
124
138
1. When sending someone a note, emit the note log to the recipient (the function encrypts the log in such a way that only a recipient can decrypt it). PXE then tries to decrypt all the encrypted logs, and stores the successfully decrypted one. [More info here](../how_to_emit_event.md)
125
139
2. Manually delivering it via a custom contract method, if you choose to not emit logs to save gas or when creating a note in the public domain and want to consume it in private domain (`encrypt_and_emit_note` shouldn't be called in the public domain because everything is public), like in the previous section where we created a note in public that doesn't have a designated owner.
0 commit comments