Skip to content

Commit

Permalink
fixed docs imports
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Feb 8, 2024
1 parent 3acf03a commit c8dddc5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/docs/developers/contracts/portals/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ To consume the message, we can use the `consume_l1_to_l2_message` function withi
Note that while the `secret` and the `content` are both hashed, they are actually hashed with different hash functions!
:::

#include_code context_consume_l1_to_l2_message /yarn-project/aztec-nr/aztec/src/context/private.nr rust
#include_code context_consume_l1_to_l2_message /yarn-project/aztec-nr/aztec/src/context/private_context.nr rust

Computing the `content` must be done manually in its current form, as we are still adding a number of bytes utilities. A good example exists within the [Token bridge example](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/token_bridge_contract/src/util.nr).

Expand Down Expand Up @@ -78,7 +78,7 @@ The portal must ensure that the sender is as expected. One way to do this is to

To send a message to L1 from your Aztec contract, you must use the `message_portal` function on the `context`. When messaging to L1, only the `content` is required (as a `Field`).

#include_code context_message_portal /yarn-project/aztec-nr/aztec/src/context/private.nr rust
#include_code context_message_portal /yarn-project/aztec-nr/aztec/src/context/private_context.nr rust

When sending a message from L2 to L1 we don't need to pass recipient, deadline, secret nor fees. Recipient is populated with the attached portal and the remaining values are not needed as the message is inserted into the outbox at the same time as it was included in a block (for the inbox it could be inserted and then only included in rollup block later).

Expand Down
10 changes: 5 additions & 5 deletions docs/docs/developers/contracts/syntax/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ The following section will cover both contexts.
## The Private Context

The code snippet below shows what is contained within the private context.
#include_code private-context /yarn-project/aztec-nr/aztec/src/context/private.nr rust
#include_code private-context /yarn-project/aztec-nr/aztec/src/context/private_context.nr rust

### Private Context Broken Down

#### Inputs

The context inputs includes all of the information that is passed from the kernel circuit into the application circuit. It contains the following values.

#include_code private-context-inputs /yarn-project/aztec-nr/aztec/src/abi.nr rust
#include_code private-context-inputs /yarn-project/aztec-nr/aztec/src/context/inputs/private_context_inputs.nr rust

As shown in the snippet, the application context is made up of 4 main structures. The call context, the block header, the contract deployment data and the private global variables.

Expand Down Expand Up @@ -89,7 +89,7 @@ Just like with the `is_contract_deployment` flag mentioned earlier. This data wi

In the private execution context, we only have access to a subset of the total global variables, we are restricted to those which can be reliably proven by the kernel circuits.

#include_code private-global-variables /yarn-project/aztec-nr/aztec/src/abi.nr rust
#include_code private-global-variables /yarn-project/aztec-nr/aztec/src/context/globals/private_global_variables.nr rust

### Args Hash

Expand Down Expand Up @@ -141,10 +141,10 @@ The Public Context includes all of the information passed from the `Public VM` i

In the current version of the system, the public context is almost a clone of the private execution context. It contains the same call context data, access to the same historical tree roots, however it does NOT have access to contract deployment data, this is due to traditional contract deployments only currently being possible from private transactions.

#include_code public-context-inputs /yarn-project/aztec-nr/aztec/src/abi.nr rust
#include_code public-context-inputs /yarn-project/aztec-nr/aztec/src/context/inputs/public_context_inputs.nr rust

### Public Global Variables

The public global variables are provided by the rollup sequencer and consequently contain some more values than the private global variables.

#include_code public-global-variables /yarn-project/aztec-nr/aztec/src/abi.nr rust
#include_code global-variables /yarn-project/noir-protocol-circuits/src/crates/types/src/abis/global_variables.nr rust
4 changes: 2 additions & 2 deletions docs/docs/developers/contracts/syntax/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ For developers coming from solidity, this concept will be similar to how the glo
`Aztec` has two execution environments, Private and Public. Each execution environment contains a different global variables object.

## Private Global Variables
#include_code private-global-variables /yarn-project/aztec-nr/aztec/src/abi.nr rust
#include_code private-global-variables /yarn-project/aztec-nr/aztec/src/context/globals/private_global_variables.nr rust

The private global variables contain:
### Chain Id
Expand All @@ -27,7 +27,7 @@ context.version();


## Public Global Variables
#include_code public-global-variables /yarn-project/aztec-nr/aztec/src/abi.nr rust
#include_code global-variables /yarn-project/noir-protocol-circuits/src/crates/types/src/abis/global_variables.nr rust

The public global variables contain the values present in the `private global variables` described above, with the addition of:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::{
},
};

// docs:start:global-variables
struct GlobalVariables {
chain_id : Field,
version : Field,
Expand All @@ -24,6 +25,7 @@ struct GlobalVariables {
coinbase : EthAddress,
fee_recipient : AztecAddress,
}
// docs:end:global-variables

impl Serialize<GLOBAL_VARIABLES_LENGTH> for GlobalVariables {
fn serialize(self) -> [Field; GLOBAL_VARIABLES_LENGTH] {
Expand Down

0 comments on commit c8dddc5

Please sign in to comment.