Skip to content

Commit 2a4188c

Browse files
authored
fix(docs): Update debugging docs (#9200)
Updates the debugging docs to actually work. closes: AztecProtocol/dev-rel#396
1 parent 419642b commit 2a4188c

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

docs/docs/reference/developer_references/debugging.md

+16-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ You can log statements from Aztec.nr contracts that will show ups in the Sandbox
1111

1212
### Import `debug_log`
1313

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

1616
```rust
1717
use dep::aztec::oracle::debug_log::{ debug_log };
@@ -47,16 +47,21 @@ debug_log_array(my_array);
4747

4848
### Start Sandbox in debug mode
4949

50-
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.
51-
52-
```bash
53-
# Using the docker-compose.yml setup
54-
cd ~/.aztec && DEBUG=aztec:* docker-compose up
55-
```
56-
57-
Alternatively you can update the `DEBUG` environment variable in docker-compose.yml and start the sandbox normally.
50+
Update the `DEBUG` environment variable in docker-compose.sandbox.yml to the following:
5851

5952
```yml
60-
environment:
61-
DEBUG: aztec:*
53+
# ~/.aztec/docker-compose.sandbox.yml
54+
55+
# ...
56+
57+
aztec:
58+
image: "aztecprotocol/aztec"
59+
ports:
60+
- "${PXE_PORT:-8080}:${PXE_PORT:-8080}"
61+
environment:
62+
DEBUG: aztec:simulator:client_execution_context, aztec:sandbox, aztec:avm_simulator:debug_log
63+
LOG_LEVEL: verbose # optionally add this for more logs
64+
# ...
6265
```
66+
67+
and start the sandbox normally.

docs/docs/reference/developer_references/sandbox_reference/sandbox-reference.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ For a quick start, follow the [guide](../../../guides/developer_guides/getting_s
1313

1414
There are various environment variables you can use when running the whole sandbox or when running on of the available modes.
1515

16-
To change them, you can open `~/.aztec/docker-compose.yml` and edit them directly.
16+
To change them, you can open `~/.aztec/docker-compose.sandbox.yml` and edit them directly.
1717

1818
**Sandbox**
1919

2020
```sh
2121
DEBUG=aztec:* # The level of debugging logs to be displayed. using "aztec:*" will log everything.
22-
HOST_WORKDIR='${PWD}' # The location to store log outpus. Will use ~/.aztec where the docker-compose.yml file is stored by default.
22+
LOG_LEVEL=debug # Setting to 'debug' will print the debug logs
23+
HOST_WORKDIR='${PWD}' # The location to store log outputs. Will use ~/.aztec where the docker-compose.yml file is stored by default.
2324
ETHEREUM_HOST=http://ethereum:8545 # The Ethereum JSON RPC URL. We use an anvil instance that runs in parallel to the sandbox on docker by default.
2425
L1_CHAIN_ID=31337 # The Chain ID that the Ethereum host is using.
2526
TEST_ACCOUNTS='true' # Option to deploy 3 test account when sandbox starts. (default: true)
@@ -78,7 +79,7 @@ SEQ_MAX_SECONDS_BETWEEN_BLOCKS=0 # Sequencer will produce a block with less than
7879
SEQ_MIN_SECONDS_BETWEEN_BLOCKS=0 # Minimum seconds to wait between consecutive blocks. (default: 0)
7980

8081
## Validator variables ##
81-
VALIDATOR_PRIVATE_KEY=0x01234567890abcde01234567890abcde # Private key of the ethereum account that will be used to perform validator duties
82+
VALIDATOR_PRIVATE_KEY=0x01234567890abcde01234567890abcde # Private key of the ethereum account that will be used to perform validator duties
8283
```
8384

8485
**PXE**
@@ -158,7 +159,7 @@ UniswapContractArtifact
158159

159160
> <sup><sub><a href="https://github.com/AztecProtocol/aztec-packages/blob/master//yarn-project/end-to-end/src/composed/cli_docs_sandbox.test.ts#L95-L118" target="_blank" rel="noopener noreferrer">Source code: /yarn-project/end-to-end/src/composed/cli_docs_sandbox.test.ts#L95-L118</a></sub></sup>
160161
161-
You can see all of our example contracts in the monorepo [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/master/noir-projects/noir-contracts/contracts).
162+
You can see all of our example contracts in the monorepo [here (GitHub link)](https://github.com/AztecProtocol/aztec-packages/tree/master/noir-projects/noir-contracts/contracts).
162163

163164
## Running Aztec PXE / Node / P2P-Bootstrap node individually
164165

@@ -176,4 +177,4 @@ To update the sandbox, run:
176177

177178
```bash
178179
aztec-up
179-
```
180+
```

docs/docs/tutorials/codealong/contract_tutorials/counter_contract.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ easy_private_state = { git="https://github.com/AztecProtocol/aztec-packages/", t
6161
Go to `main.nr` and start with this contract initialization:
6262

6363
```rust
64-
contract Counter {
64+
#include_code setup /noir-projects/noir-contracts/contracts/counter_contract/src/main.nr raw
6565
}
6666
```
6767

@@ -159,4 +159,4 @@ Follow the private voting contract tutorial on the [next page](./private_voting_
159159

160160
### Optional: Learn more about concepts mentioned here
161161

162-
- [Functions and annotations like `#[aztec(private)]`](../../../aztec/smart_contracts/functions/inner_workings.md)
162+
- [Functions and annotations like `#[aztec(private)]`](../../../aztec/smart_contracts/functions/inner_workings.md)

noir-projects/noir-contracts/contracts/counter_contract/src/main.nr

+2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
// docs:start:setup
12
use dep::aztec::macros::aztec;
23

34
#[aztec]
45
contract Counter {
6+
// docs:end:setup
57
// docs:start:imports
68
use aztec::prelude::{AztecAddress, Map};
79
use value_note::{balance_utils, value_note::ValueNote};

0 commit comments

Comments
 (0)