Skip to content

Commit 6af548e

Browse files
catmcgeecritesjosh
andauthored
feat(docs): Docs deeper dive into unconstrained functions (AztecProtocol#4233)
Closes AztecProtocol/dev-rel#140 This is the new text - https://github.com/AztecProtocol/aztec-packages/pull/4233/files#diff-5cb9aa6cb90dbac61cb1828879ea8a227933807363bcf53683e7c7a833e27e0bR75 --------- Co-authored-by: josh crites <[email protected]> Co-authored-by: Josh Crites <[email protected]>
1 parent bbdad91 commit 6af548e

23 files changed

Lines changed: 400 additions & 355 deletions

File tree

docs/docs/developers/contracts/compiling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Read more about interacting with contracts using `aztec.js` [here](../getting_st
115115

116116
### Aztec.nr interfaces
117117

118-
An Aztec.nr contract can [call a function](./syntax/functions.md) in another contract via `context.call_private_function` or `context.call_public_function`. However, this requires manually assembling the function selector and manually serializing the arguments, which is not type-safe.
118+
An Aztec.nr contract can [call a function](./syntax/functions/main.md) in another contract via `context.call_private_function` or `context.call_public_function`. However, this requires manually assembling the function selector and manually serializing the arguments, which is not type-safe.
119119

120120
To make this easier, the compiler can generate contract interface structs that expose a convenience method for each function listed in a given contract artifact. These structs are intended to be used from another contract project that calls into the current one. For each contract, two interface structs are generated: one to be used from private functions with a `PrivateContext`, and one to be used from open functions with a `PublicContext`.
121121

@@ -209,7 +209,7 @@ impl TokenPublicContextInterface {
209209
}
210210
```
211211

212-
Read more about how to use the Aztec.nr interfaces [here](./syntax/functions.md#contract-interface).
212+
Read more about how to use the Aztec.nr interfaces [here](./syntax/functions/main.md).
213213

214214
:::info
215215
At the moment, the compiler generates these interfaces from already compiled ABIs, and not from source code. This means that you should not import a generated interface from within the same project as its source contract, or you risk circular references.

docs/docs/developers/contracts/layout.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Structure
33
---
44

5-
A contract is a collection of persistent [state variables](./syntax/storage/main.md), and [functions](./syntax/functions) which may manipulate these variables. Functions and state variables within a contract's scope are said to belong to that contract. A contract can only access and modify its own state. If a contract wishes to access or modify another contract's state, it must make a call to an external function of the other contract. For anything to happen on the Aztec network, an external function of a contract needs to be called.
5+
A contract is a collection of persistent [state variables](./syntax/storage/main.md), and [functions](./syntax/functions/main.md) which may manipulate these variables. Functions and state variables within a contract's scope are said to belong to that contract. A contract can only access and modify its own state. If a contract wishes to access or modify another contract's state, it must make a call to an external function of the other contract. For anything to happen on the Aztec network, an external function of a contract needs to be called.
66

77
# Contract
88

docs/docs/developers/contracts/resources/common_patterns/authwit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: Developer Documentation to use Authentication Witness for authentic
1111

1212
Authentication Witness is a scheme for authentication actions on Aztec, so users can allow third-parties (eg protocols or other users) to execute an action on their behalf.
1313

14-
How it works logically is explained in the [foundational concepts](./../../../../learn/concepts/accounts/authwit.md) but we will do a short recap here.
14+
How it works logically is explained in the [concepts](./../../../../learn/concepts/accounts/authwit.md) but we will do a short recap here.
1515

1616
An authentication witness is defined for a specific action, such as allowing a Defi protocol to transfer funds on behalf of the user. An action is here something that could be explained as `A is allowed to perform X operation on behalf of B` and we define it as a hash computed as such:
1717

docs/docs/developers/contracts/syntax/context.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ The `args_hash` is the result of pedersen hashing all of a function's inputs.
9999

100100
### Return Values
101101

102-
The return values are a set of values that are returned from an applications execution to be passed to other functions through the kernel. Developers do not need to worry about passing their function return values to the `context` directly as `Aztec.nr` takes care of it for you. See the documentation surrounding `Aztec.nr` [macro expansion](./functions.md#after-expansion) for more details.
102+
The return values are a set of values that are returned from an applications execution to be passed to other functions through the kernel. Developers do not need to worry about passing their function return values to the `context` directly as `Aztec.nr` takes care of it for you. See the documentation surrounding `Aztec.nr` [macro expansion](./functions/inner_workings.md#after-expansion) for more details.
103103

104104
return_values : BoundedVec<Field, RETURN_VALUES_LENGTH>,
105105

docs/docs/developers/contracts/syntax/events.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ In the future we will allow emitting arbitrary information.
6161
(If you currently emit arbitrary information, PXE will fail to decrypt, process and store this data, so it will not be queryable).
6262
:::
6363

64-
To emit encrypted logs first import the `emit_encrypted_log` utility function which wraps an [oracle](./functions.md#oracle-functions):
64+
To emit encrypted logs first import the `emit_encrypted_log` utility function which wraps an [oracle](./functions/oracles.md):
6565

6666
#include_code encrypted_import /yarn-project/aztec-nr/address-note/src/address_note.nr rust
6767

@@ -95,7 +95,7 @@ They can be emitted by both public and private functions.
9595

9696
:::danger
9797
- Emitting unencrypted events from private function is a significant privacy leak and it should be considered by the developer whether it is acceptable.
98-
- Unencrypted events are currently **NOT** linked to the contract emitting them, so it is practically a [`debug_log`](./functions.md#a-few-useful-inbuilt-oracles).
98+
- Unencrypted events are currently **NOT** linked to the contract emitting them, so it is practically a [`debug_log`](./functions/oracles.md#a-few-useful-inbuilt-oracles).
9999
:::
100100

101101
To emit unencrypted logs first import the `emit_unencrypted_log` utility function inside your contract:

0 commit comments

Comments
 (0)