diff --git a/docs/docs/reference/developer_references/debugging.md b/docs/docs/reference/developer_references/debugging.md index 29b6be17ff4..1946ec9f5c1 100644 --- a/docs/docs/reference/developer_references/debugging.md +++ b/docs/docs/reference/developer_references/debugging.md @@ -11,7 +11,7 @@ You can log statements from Aztec.nr contracts that will show ups in the Sandbox ### Import `debug_log` -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: +Import the `debug_log` dependency from Aztec oracles: ```rust use dep::aztec::oracle::debug_log::{ debug_log }; @@ -47,16 +47,21 @@ debug_log_array(my_array); ### 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. - -```bash -# Using the docker-compose.yml setup -cd ~/.aztec && DEBUG=aztec:* docker-compose up -``` - -Alternatively you can update the `DEBUG` environment variable in docker-compose.yml and start the sandbox normally. +Update the `DEBUG` environment variable in docker-compose.sandbox.yml to the following: ```yml -environment: - DEBUG: aztec:* +# ~/.aztec/docker-compose.sandbox.yml + +# ... + +aztec: + image: "aztecprotocol/aztec" + ports: + - "${PXE_PORT:-8080}:${PXE_PORT:-8080}" + environment: + DEBUG: aztec:simulator:client_execution_context, aztec:sandbox, aztec:avm_simulator:debug_log + LOG_LEVEL: verbose # optionally add this for more logs + # ... ``` + +and start the sandbox normally. diff --git a/docs/docs/reference/developer_references/sandbox_reference/sandbox-reference.md b/docs/docs/reference/developer_references/sandbox_reference/sandbox-reference.md index 394439049bc..e834682da19 100644 --- a/docs/docs/reference/developer_references/sandbox_reference/sandbox-reference.md +++ b/docs/docs/reference/developer_references/sandbox_reference/sandbox-reference.md @@ -13,13 +13,14 @@ For a quick start, follow the [guide](../../../guides/developer_guides/getting_s There are various environment variables you can use when running the whole sandbox or when running on of the available modes. -To change them, you can open `~/.aztec/docker-compose.yml` and edit them directly. +To change them, you can open `~/.aztec/docker-compose.sandbox.yml` and edit them directly. **Sandbox** ```sh DEBUG=aztec:* # The level of debugging logs to be displayed. using "aztec:*" will log everything. -HOST_WORKDIR='${PWD}' # The location to store log outpus. Will use ~/.aztec where the docker-compose.yml file is stored by default. +LOG_LEVEL=debug # Setting to 'debug' will print the debug logs +HOST_WORKDIR='${PWD}' # The location to store log outputs. Will use ~/.aztec where the docker-compose.yml file is stored by default. 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. L1_CHAIN_ID=31337 # The Chain ID that the Ethereum host is using. 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 SEQ_MIN_SECONDS_BETWEEN_BLOCKS=0 # Minimum seconds to wait between consecutive blocks. (default: 0) ## Validator variables ## -VALIDATOR_PRIVATE_KEY=0x01234567890abcde01234567890abcde # Private key of the ethereum account that will be used to perform validator duties +VALIDATOR_PRIVATE_KEY=0x01234567890abcde01234567890abcde # Private key of the ethereum account that will be used to perform validator duties ``` **PXE** @@ -158,7 +159,7 @@ UniswapContractArtifact > Source code: /yarn-project/end-to-end/src/composed/cli_docs_sandbox.test.ts#L95-L118 -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). +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). ## Running Aztec PXE / Node / P2P-Bootstrap node individually @@ -176,4 +177,4 @@ To update the sandbox, run: ```bash aztec-up -``` \ No newline at end of file +``` diff --git a/docs/docs/tutorials/codealong/contract_tutorials/counter_contract.md b/docs/docs/tutorials/codealong/contract_tutorials/counter_contract.md index 017643618aa..3cada7c837f 100644 --- a/docs/docs/tutorials/codealong/contract_tutorials/counter_contract.md +++ b/docs/docs/tutorials/codealong/contract_tutorials/counter_contract.md @@ -61,7 +61,7 @@ easy_private_state = { git="https://github.com/AztecProtocol/aztec-packages/", t Go to `main.nr` and start with this contract initialization: ```rust -contract Counter { +#include_code setup /noir-projects/noir-contracts/contracts/counter_contract/src/main.nr raw } ``` @@ -159,4 +159,4 @@ Follow the private voting contract tutorial on the [next page](./private_voting_ ### Optional: Learn more about concepts mentioned here - - [Functions and annotations like `#[aztec(private)]`](../../../aztec/smart_contracts/functions/inner_workings.md) +- [Functions and annotations like `#[aztec(private)]`](../../../aztec/smart_contracts/functions/inner_workings.md) diff --git a/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr b/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr index 42bc8c396f8..ed625c82a5a 100644 --- a/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr @@ -1,7 +1,9 @@ +// docs:start:setup use dep::aztec::macros::aztec; #[aztec] contract Counter { + // docs:end:setup // docs:start:imports use aztec::prelude::{AztecAddress, Map}; use value_note::{balance_utils, value_note::ValueNote};