Skip to content

Commit

Permalink
chore(docs): Fix links (#7602)
Browse files Browse the repository at this point in the history
This PR makes some absolute links relative, updates some links to point
to the correct pages and fixes some formatting on a debugger page

---------

Co-authored-by: Cat McGee <[email protected]>
  • Loading branch information
critesjosh and catmcgee authored Jul 29, 2024
1 parent 921773f commit f2029be
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 32 deletions.
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ All the packages that make up [Aztec](https://docs.aztec.network).
- [**`yarn-project`**](/yarn-project): Typescript code for client and backend
- [**`docs`**](/docs): Documentation source for the docs site

## Getting Started

Want to start quickly? Get started in minutes with a free Github Codespace.

[![One-Click React Starter](.devcontainer/assets/react_cta_badge.svg)](https://codespaces.new/AztecProtocol/aztec-packages?devcontainer_path=.devcontainer%2Freact%2Fdevcontainer.json) [![One-Click HTML/TS Starter](.devcontainer/assets/vanilla_cta_badge.svg)](https://codespaces.new/AztecProtocol/aztec-packages?devcontainer_path=.devcontainer%2Fvanilla%2Fdevcontainer.json) [![One-Click Token Starter](.devcontainer/assets/token_cta_badge.svg)](https://codespaces.new/AztecProtocol/aztec-packages?devcontainer_path=.devcontainer%2Ftoken%2Fdevcontainer.json)

## Popular packages

- [Aztec.nr](./noir-projects/aztec-nr/): A [Noir](https://noir-lang.org) framework for smart contracts on Aztec.
Expand All @@ -23,7 +17,7 @@ Want to start quickly? Get started in minutes with a free Github Codespace.

## Issues Board

All issues being worked on are tracked on the [Aztec Github Project](https://github.com/orgs/AztecProtocol/projects/22). For a higher-level roadmap, check the [milestones overview](https://docs.aztec.network/misc/roadmap/main) section of our docs.
All issues being worked on are tracked on the [Aztec Github Project](https://github.com/orgs/AztecProtocol/projects/22). For a higher-level roadmap, check the [milestones overview](https://docs.aztec.network/aztec/roadmap) section of our docs.

## Development Setup

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/aztec/glossary/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Previously in [Aztec Connect](https://medium.com/aztec-protocol/sunsetting-aztec

Programs that run on the Aztec network are called smart contracts, similar to [programs](https://ethereum.org/en/developers/docs/smart-contracts/) that run on Ethereum.

However, these will be written in the [Noir](https://noir-lang.org/index.html) programming language, and may optionally include [private state and private functions](https://docs.aztec.network/aztec/how-it-works/private-smart-contracts).
However, these will be written in the [Noir](https://noir-lang.org/index.html) programming language, and may optionally include [private state and private functions](../../aztec/core_components.md).

### Proving Key

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/guides/local_env/versions-updating.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If you get an error like: `Cannot read file ~/nargo/github.com/AztecProtocol/azt
Check the `git=` github url, tag, and directory.

:::note
The folder structure changed at **0.24.0** from `yarn-project/aztec-nr` to `noir-projects/aztec-nr`. More details [here](https://docs.aztec.network/misc/migration_notes#aztecnr-aztec-nr-contracts-location-change-in-nargotoml)
The folder structure changed at **0.24.0** from `yarn-project/aztec-nr` to `noir-projects/aztec-nr`. More details [here](../../migration_notes.md#aztecnr-aztec-nr-contracts-location-change-in-nargotoml)
:::

### Example contract versions
Expand All @@ -51,7 +51,7 @@ diff ~/nargo/github.com/AztecProtocol/aztec-packages-v0.23.0/yarn-project/noir-c

### Language server version (aztec-nargo)

The [Noir LSP](https://docs.aztec.network/developers/contracts/main.md#install-noir-lsp-recommended) uses your local version of `aztec-nargo`, and thus also `aztec-nargo compile`.
The [Noir LSP](../../getting_started.md#install-noir-lsp-recommended) uses your local version of `aztec-nargo`, and thus also `aztec-nargo compile`.
The path of the former (once installed) can be seen by hovering over "Nargo" in the bottom status bar of VS Code, and the latter via the `which aztec-nargo` command.

:::caution
Expand Down
11 changes: 6 additions & 5 deletions docs/docs/reference/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ title: Debugging
sidebar_position: 2
---

On this section you can learn how to debug your Aztec.nr smart contracts and common errors that you may run into.
## Logging in Aztec.nr

# Logging in Aztec.nr
On this section you can learn how to debug your Aztec.nr smart contracts and common errors that you may run into.

You can log statements from Aztec.nr contracts that will show ups in the Sandbox.

**Import debug_log**
### Import `debug_log`

Import the [`debug_log`](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/aztec/src/oracle/debug_log.nr) dependency from Aztec oracles:

```rust
use dep::aztec::oracle::debug_log::{ debug_log };
```

**Write log**
### Write log

Write `debug_log()` in the appropriate place in your contract.

Expand Down Expand Up @@ -44,7 +45,7 @@ debug_log_field(my_field);
debug_log_array(my_array);
```

**Start Sandbox in debug mode**
### Start Sandbox in debug mode

Prepend the command to start the sandbox with `DEBUG=aztec:*` to log everything or `DEBUG=aztec:simulator:oracle` to only log your `debug_log()` statements.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ We recommend going through this setup to fully understand where things live.

- [node v18+](https://github.com/tj/n)
- [docker](https://docs.docker.com/)
- [Aztec sandbox](https://docs.aztec.network/developers/getting_started/sandbox) - you should have this running before starting the tutorial
- [Aztec sandbox](../../../../getting_started.md) - you should have this running before starting the tutorial

```bash
/bin/sh -c "$(curl -fsSL 'https://sandbox.aztec.network')"
Expand Down
20 changes: 9 additions & 11 deletions docs/docs/tutorials/contract_tutorials/crowdfunding_contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Along the way you will:

### Install tools

Please ensure that the you already have [Installed the Sandbox](https://docs.aztec.network/developers/getting_started/quickstart#install-the-sandbox).
Please ensure that the you already have [Installed the Sandbox](../../getting_started.md).

And if using VSCode, see [here](https://docs.aztec.network/developers/contracts/main.md#install-noir-lsp-recommended) to install Noir LSP, where you'll benefit from syntax highlighting, profiling, and more.
And if using VSCode, see [here](../../getting_started.md#install-noir-lsp-recommended) to install Noir LSP, where you'll benefit from syntax highlighting, profiling, and more.

### Create an Aztec project

Expand Down Expand Up @@ -95,10 +95,11 @@ aztec = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_
```

A word about versions:

- Choose the aztec packages version to match your aztec sandbox version
- Check that your `compiler_version` in Nargo.toml is satisified by your aztec compiler - `aztec-nargo -V`

More about versions [here](https://docs.aztec.network/developers/versions-updating).
More about versions [here](../../guides/local_env/versions-updating.md).

Inside the Crowdfunding contract definition, use the dependency that defines the address type `AztecAddress` (same syntax as Rust)

Expand All @@ -108,7 +109,6 @@ use dep::aztec::protocol_types::address::AztecAddress;

The `aztec::protocol_types` can be browsed [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-protocol-circuits/crates/types/src). And like rust dependencies, the relative path inside the dependency corresponds to `address::AztecAddress`.


#### Storage

To retain the initializer parameters in the contract's Storage, we'll need to declare them in a preceding `Storage` struct:
Expand All @@ -117,8 +117,6 @@ To retain the initializer parameters in the contract's Storage, we'll need to de

The `ValueNote` type is in the top-level of the Aztec.nr framework, namely [noir-projects/aztec-nr](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/value-note/src/value_note.nr). Like before, you'll need to add the crate to Nargo.toml

(See [here](https://docs.aztec.network/developers/contracts/resources/dependencies) for common dependencies).

---

Back in main.nr, reference `use` of the type
Expand All @@ -137,7 +135,7 @@ You can compile the code so far with `aztec-nargo compile`.

#### Checking campaign duration against the timestamp

To check that the donation occurs before the campaign deadline, we must access the public `timestamp`. It is one of several [Public Global Variables](https://docs.aztec.network/developers/contracts/references/globals#public-global-variables).
To check that the donation occurs before the campaign deadline, we must access the public `timestamp`. It is one of several [Public Global Variables](../../reference/smart_contract_reference/globals).

Declare an Aztec function that is public and internal

Expand All @@ -153,7 +151,7 @@ Read the deadline from storage and assert that the `timestamp` from this context

---

Since donations are to be private, the donate function will have the user's private context which has these [Private Global Variables](https://docs.aztec.network/developers/contracts/references/globals#private-global-variables). So from the private context there is a little extra to call the (public internal) `_check_deadline` function.
Since donations are to be private, the donate function will have the user's private context which has these [Private Global Variables](../../reference/smart_contract_reference/globals.md). So from the private context there is a little extra to call the (public internal) `_check_deadline` function.

```rust
#include_code call-check-deadline /noir-projects/noir-contracts/contracts/crowdfunding_contract/src/main.nr raw
Expand All @@ -169,7 +167,6 @@ Now conclude adding all dependencies to the `Crowdfunding` contract:

Like before, you can find these and other `aztec::protocol_types` [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-protocol-circuits/crates/types/src).


#### Interfacing with another contract

The token being used for donations is stored simply as an `AztecAddress` (named `donation_token`). so to easily use it as a token, we let the compiler know that we want the address to have a Token interface. Here we will use a maintained example Token contract.
Expand All @@ -180,7 +177,7 @@ Add this `Token` contract to Nargo.toml:
token = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="noir-projects/noir-contracts/contracts/token_contract" }
```

With the dependency already `use`d at the start of the contract, the token contract can be called to make the transfer from msg sender to this contract.
With the dependency already `use`d at the start of the contract, the token contract can be called to make the transfer from msg sender to this contract.

:::note
The user must have authorised this action (concept [here](../../aztec/concepts/accounts/index.md#authorizing-actions)), example use of `createAuthWit` in 'full donor flow' test [here](../../../../yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts).
Expand All @@ -195,11 +192,12 @@ The last thing to do is create a new value note and add it to the `donation_rece
### 3. Operator withdrawals

The remaining function to implement, `withdraw`, is reasonably straight-forward:

1. make sure the address calling is the operator address
2. transfer tokens from the contract to the operator
3. reveal that an amount has been withdrawn to the operator

The last point is achieved by emitting an unencrypted event log, more [here](https://docs.aztec.network/developers/contracts/writing_contracts/events/emit_event#unencrypted-events).
The last point is achieved by emitting an unencrypted event log, more [here](../../guides/smart_contracts/writing_contracts/how_to_emit_event.md#unencrypted-events).

Copy the last function into your Crowdfunding contract:

Expand Down
6 changes: 4 additions & 2 deletions yarn-project/aztec.js/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Aztec.js

Aztec.js is a library that provides APIs for managing accounts and interacting with contracts on the Aztec network. It communicates with the [Private eXecution Environment (PXE)](https://docs.aztec.network/apis/pxe/interfaces/PXE) through a `PXE` implementation, allowing developers to easily register new accounts, deploy contracts, view functions, and send transactions.
Aztec.js is a library that provides APIs for managing accounts and interacting with contracts on the Aztec network. It communicates with the [Private eXecution Environment (PXE)](https://docs.aztec.network/reference/aztecjs/pxe) through a `PXE` implementation, allowing developers to easily register new accounts, deploy contracts, view functions, and send transactions.

## Installing

Expand All @@ -17,7 +17,9 @@ Use the `@aztec/accounts` package in order to create and manage accounts, and ac
```typescript
import { Contract } from '@aztec/aztec.js';

const contract = await Contract.deploy(wallet, MyContractArtifact, [...constructorArgs]).send().deployed();
const contract = await Contract.deploy(wallet, MyContractArtifact, [...constructorArgs])
.send()
.deployed();
console.log(`Contract deployed at ${contract.address}`);
```

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/entrypoints/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* The `@aztec/accounts/defaults` export provides the base class {@link DefaultAccountContract} for implementing account contracts that use the default entrypoint payload module.
*
* Read more in {@link https://docs.aztec.network/developers/wallets/writing_an_account_contract | Writing an account contract}.
* Read more in {@link https://docs.aztec.network/tutorials/write_accounts_contract | Writing an account contract}.
*
* @packageDocumentation
*/
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/pxe/src/pxe_service/pxe_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ export class PXEService implements PXE {
const contract = await this.db.getContract(to);
if (!contract) {
throw new Error(
`Unknown contract ${to}: add it to PXE Service by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/developers/debugging/aztecnr-errors#unknown-contract-0x0-add-it-to-pxe-by-calling-serveraddcontracts`,
`Unknown contract ${to}: add it to PXE Service by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/reference/common_errors/aztecnr-errors#unknown-contract-0x0-add-it-to-pxe-by-calling-serveraddcontracts`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/pxe/src/simulator_oracle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class SimulatorOracle implements DBOracle {
if (!completeAddress) {
throw new Error(
`No public key registered for address ${account}.
Register it by calling pxe.registerRecipient(...) or pxe.registerAccount(...).\nSee docs for context: https://docs.aztec.network/developers/debugging/aztecnr-errors#simulation-error-No-public-key-registered-for-address-0x0-Register-it-by-calling-pxeregisterRecipient-or-pxeregisterAccount`,
Register it by calling pxe.registerRecipient(...) or pxe.registerAccount(...).\nSee docs for context: https://docs.aztec.network/reference/common_errors/aztecnr-errors#simulation-error-no-public-key-registered-for-address-0x0-register-it-by-calling-pxeregisterrecipient-or-pxeregisteraccount`,
);
}
return completeAddress;
Expand Down

0 comments on commit f2029be

Please sign in to comment.