Conversation
2ab0f65 to
319aada
Compare
LHerskind
left a comment
There was a problem hiding this comment.
The renders generally get really funky indention @iAmMichaelConnor might have an idea there?
| Behind the scenes, Aztec noir will pass data the kernel needs to and from a circuit, this is abstracted away from the developer. In an developer's eyes; the context is a useful structure that allows access and mutate the state of the `Aztec` blockchain. | ||
|
|
||
| ## Two context's one API | ||
| The `Aztec` blockchain contains two execution environments (ADD REFERENCE). |
There was a problem hiding this comment.
The ADD REFERENCE should either be fixed or have an issue or something.
|
|
||
| When calling the `consume_l1_to_l2_message` function on a contract; a number of actions are performed by `Aztec.nr`. | ||
|
|
||
| 1. The `msgKey` value (passed to the consume message function) is used to look up the contents of the l1 message. |
There was a problem hiding this comment.
Idea time, should we have this as an oracle instead to get it out of the input parameters here.
There was a problem hiding this comment.
that would leave the node with alot of extra indexing
There was a problem hiding this comment.
Why? You don't need the oracle to index it, you just use the oracle to pass in the value 🤷, that could happen similarly to the auth witnesses, but it allow us to update with an index down the line if useful.
|
|
||
| Each Aztec function has access to a [context](./context.md) object. This object although ergonomically a global variable, is local. It is initialized from the inputs provided by the kernel, and a hash of the function's inputs. | ||
|
|
||
| #include_code context-example-context-return /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust |
There was a problem hiding this comment.
Should there be a small header here as well?
| ... | ||
| } | ||
| ``` | ||
| #include_code send_to_portal /yarn-project/noir-contracts/src/contracts/non_native_token_contract/src/main.nr rust |
There was a problem hiding this comment.
Needs to be updated along with #2177. Adding a comment here for reference.
| DataStructures.L1Actor recipient; | ||
| bytes32 content; | ||
| } | ||
| <!-- TODO: the rest of these docs should have code snippets updates --> |
There was a problem hiding this comment.
Is there an issue, or should it be fixed in this pr?
There was a problem hiding this comment.
did it in this pr, will revert in this one
| aztec = { git="https://github.com/AztecProtocol/aztec-packages", tag="master", directory="yarn-project/noir-libs/noir-aztec" } | ||
| ``` | ||
|
|
||
| Note: currently the dependency name ***MUST*** be `aztec`. The framework expects this namespace to be available when compiling into contracts. This limitation may be removed in the future. No newline at end of file |
There was a problem hiding this comment.
Would probably be better to make this a larger note os one of the info boxes.
Funky indentation? Of code snippets, you mean? I opened an issue earlier about weird code snippet indentation #2189 |
…ackages into md/document-macros
…ackages into md/document-macros
Documents the global variables
| However; `#aztec(private)` is just syntactic sugar. At compile time, the framework inserts code that allows the function to interact with the [kernel](../../concepts/advanced/circuits/kernels/private_kernel.md). | ||
|
|
||
| To help illustrate how this interacts with the internals of Aztec and its kernel circuits, we can take an example private function, and explore what it looks like after Aztec.nr's macro expansion. | ||
| To help illustrate how this interacts with the internals of #public-contextAztec and its kernel circuits, we can take an example private function, and explore what it looks like after Aztec.nr's macro expansion. |
There was a problem hiding this comment.
Whats going on with the # in here? Seems off.
|
|
||
| When calling the `consume_l1_to_l2_message` function on a contract; a number of actions are performed by `Aztec.nr`. | ||
|
|
||
| 1. The `msgKey` value (passed to the consume message function) is used to look up the contents of the l1 message. |
There was a problem hiding this comment.
Why? You don't need the oracle to index it, you just use the oracle to pass in the value 🤷, that could happen similarly to the auth witnesses, but it allow us to update with an index down the line if useful.
|
|
||
| ( TODO: INCLUDE A DIAGRAM HERE SHOWING HOW IT GETS UPDATED ON CONTRACT CALLS ) | ||
| > The graphic below illustrates how the message sender changes throughout the kernel circuit iterations. | ||
| <Image img={require("/img/context/sender_context_change.png")} /> |
| - In Aztec terminology, a constructor is always a 'private function' (i.e. it cannot be an `open` function). | ||
| - A constructor doesn't have a name, because its purpose is clear: to initialise contract state. | ||
| - In Aztec terminology, a constructor is always a '`private` function' (i.e. it cannot be a `public` function). | ||
| - A constructor behaves almost identically to any other function. It's just important for Aztec to be able to identify this function as special: it may only be called once, and will not be deployed as part of the contract. |
There was a problem hiding this comment.
Should probably add a comment that it also cannot call any public functions.
docs/package.json
Outdated
| "docusaurus": "docusaurus", | ||
| "start": "docusaurus start", | ||
| "start:dev": "concurrently \"yarn preprocess:dev\" \"docusaurus start --host 0.0.0.0\"", | ||
| "start:dev": "concurrently \"yarn preprocess:dev\" \"docusaurus start --host 0.0.0.0 --port 3001\"", |
…ackages into md/document-macros
LHerskind
left a comment
There was a problem hiding this comment.
The changes lgtm. When you get it building feel free to merge.
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-packages: 0.7.10</summary> ## [0.7.10](aztec-packages-v0.7.9...aztec-packages-v0.7.10) (2023-09-20) ### Features * Aztec-cli unbox "really empty box" ([#2388](#2388)) ([b57182d](b57182d)) * **docs:** Document noir macros ([#2016](#2016)) ([1f1a17f](1f1a17f)) * **docs:** Include aztec rpc interface typedoc output in docs ([#2255](#2255)) ([62c9e9b](62c9e9b)) * **token portal standard:** Create a token portal standard ([#2351](#2351)) ([426a3ea](426a3ea)) ### Bug Fixes * **build:** Fix build system post deployment tests ([#2420](#2420)) ([d509dc3](d509dc3)) * CLI encoding for arrays and structs ([#2407](#2407)) ([85283bd](85283bd)) * Correct sandbox addresses in up-quick-start test ([#2412](#2412)) ([974d859](974d859)) * **docs:** Revert include aztec rpc interface typedoc output in docs ([#2255](#2255)) ([f852432](f852432)) * Handle falsy bigints in json-rpc ([#2403](#2403)) ([d100650](d100650)), closes [#2402](#2402) * **nargo_check.sh:** UNIX standard grep ([#2396](#2396)) ([02e788a](02e788a)) ### Miscellaneous * **docs:** Note getter options ([#2411](#2411)) ([8a95d8c](8a95d8c)) * Update docs url in config ([#2386](#2386)) ([e44066d](e44066d)) </details> <details><summary>barretenberg.js: 0.7.10</summary> ## [0.7.10](barretenberg.js-v0.7.9...barretenberg.js-v0.7.10) (2023-09-20) ### Miscellaneous * **barretenberg.js:** Synchronize aztec-packages versions </details> <details><summary>barretenberg: 0.7.10</summary> ## [0.7.10](barretenberg-v0.7.9...barretenberg-v0.7.10) (2023-09-20) ### Miscellaneous * **barretenberg:** Synchronize aztec-packages versions </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Documents how the macros work and what they do.
Also adds some information about the context objects, they are required to understand the macros abstraction.
closes: #2063