Skip to content

Commit 74401d2

Browse files
authored
fix(docs): fable review (#24005)
Fixes the critical issues found in a full audit of the docs site, applied to both the source docs and the published v4.3.1 versioned docs (versioned facts verified against the `v4.3.1` tag, source facts against `next`). ## Tutorials - **Counter tutorial** (source + v4.3.1): adds the missing "clear the scaffold's placeholder test" note. As written, renaming the contract `Main` -> `Counter` leaves the generated `counter_test` crate referencing `Main`, so `aztec compile` fails with 6 errors (reproduced on a live local network). The token and recursive-verification tutorials already carry this note. - **Token bridge tutorial** (source + v4.3.1): the deploy script was inlined from the monorepo's CI example, and its artifact imports don't resolve in the Hardhat project the tutorial sets up. Adds a correction note (Hardhat artifact paths and `bytecode` vs Forge's `bytecode.object`), fixes the run command (`npx tsx scripts/index.ts` instead of `npx hardhat run ... --network localhost`, which targets a network the starter repo doesn't define), adds a note to update the starter repo's `@aztec/l1-contracts` tag (pinned to v4.2.0-aztecnr-rc.2; a `v4.3.1` tag exists upstream), and fixes a broken relative link. ## CLI references - **aztec CLI reference** (source + v4.3.1): the `aztec start` section was completely empty. Adds usage, examples, common options, and module flags (verified against `aztec_start_options.ts`), linking to the operator CLI reference for the full per-module list. - **aztec-wallet CLI reference** (source + v4.3.1): removes generator-machine leakage: `--data-dir` default `/home/josh/.aztec/wallet` -> `~/.aztec/wallet`, `--node-url` default `host.docker.internal` -> `localhost`. ## Operator docs - **useful-commands / governance-participation** (source + v4.3.1): the documented cast calls target functions that no longer exist on the governance contracts. `M()` -> `ROUND_SIZE()`, `N()` -> `QUORUM_SIZE()`, `yeaCount(...)` -> `signalCount(...)` (EmpireBase.sol), and `proposals(uint256)` (internal mapping) -> `getProposal(uint256)` (Governance.sol). - **slashing-configuration** (source + v4.3.1): the ejection description ("98% of activation, max 3 slashes") didn't match the implementation. Slashing ejection is driven by the rollup's `localEjectionThreshold` (190,000 on mainnet, 95% of the 200,000 activation threshold; StakingLib withdraws the entire remaining stake when a slash would cross it). Also fixes stale 36s-per-slot math (slots are 72s) and the "28 rounds on testnet" execution-delay label (28 rounds is mainnet). Source and v4.3.1 copies use their respective slash amounts (v4.3.1: all 2,000; next: 2,000/5,000 per AZIP-16). ## Aztec.nr / foundational topics - **events_and_logs** (source + v4.3.1): `self.context.emit_public_log(...)` doesn't exist; corrected to `emit_public_log_unsafe(tag, log)` with a pointer to prefer `self.emit(event)`. - **state_variables / how_to_retrieve_filter_notes** (source + v4.3.1): `get_notes`/`remove` documented around nonexistent `RetrievedNote`/`HintedNote` types; the actual return type is `ConfirmedNote`. - **contract_structure** (source + v4.3.1): claimed the storage struct "can have any name"; the `#[storage]` macro requires it to be named `Storage`. - **contract_creation** (source + v4.3.1): the "Proving Contract States" block used a nonexistent `aztec::history::contract_inclusion` module; replaced with the real `aztec::history::deployment` assert functions. - **outbox.md** (source only): parameter tables and `getRootData` signature updated to the checkpoint-based `IOutbox` (`Epoch` + `_numCheckpointsInEpoch`). The v4.3.1 copy matches its own interface and is untouched. Spellcheck (`yarn cspell`) passes on all 514 files.
2 parents 5d7792b + 11e15b4 commit 74401d2

35 files changed

Lines changed: 1733 additions & 360 deletions

File tree

docs/developer_versioned_docs/version-v4.3.1/docs/aztec-nr/framework-description/advanced/how_to_retrieve_filter_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ This returns up to `MAX_NOTE_HASH_READ_REQUESTS_PER_CALL` notes without filterin
3333
### Step 2: Retrieve notes from storage
3434

3535
```rust
36-
// Returns BoundedVec<HintedNote<MyNote>, ...>
37-
let hinted_notes = storage.my_notes.at(owner).get_notes(options);
36+
// Returns BoundedVec<ConfirmedNote<MyNote>, ...>
37+
let confirmed_notes = storage.my_notes.at(owner).get_notes(options);
3838
```
3939

4040
:::tip get_notes vs pop_notes

docs/developer_versioned_docs/version-v4.3.1/docs/aztec-nr/framework-description/contract_structure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub contract MyContract {
9898
};
9999
use uint_note::UintNote;
100100

101-
// The storage struct can have any name, but is typically called `Storage`. It must have the `#[storage]` macro applied to it.
101+
// The storage struct must be named `Storage` and must have the `#[storage]` macro applied to it.
102102
// This struct must also have a generic type called C or Context.
103103
#[storage]
104104
struct Storage<Context> {

docs/developer_versioned_docs/version-v4.3.1/docs/aztec-nr/framework-description/events_and_logs.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,15 @@ Public events are emitted as plaintext logs, similar to Solidity events.
8686

8787
## Emit unstructured public logs
8888

89-
For unstructured data, use `emit_public_log` directly on the context:
89+
For unstructured data, use `emit_public_log_unsafe` directly on the context. It takes a tag (placed at the first field of the emitted log, which nodes use to index logs) followed by the data:
9090

9191
```rust
92-
self.context.emit_public_log("My message");
93-
self.context.emit_public_log([1, 2, 3]);
92+
self.context.emit_public_log_unsafe(0, "My message");
93+
self.context.emit_public_log_unsafe(0, [1, 2, 3]);
9494
```
9595

96+
The tag should be domain-separated to prevent collisions with unrelated log types. Prefer `self.emit(event)` where possible, which handles tagging automatically.
97+
9698
## Query public logs
9799

98100
Query public logs from offchain applications using the Aztec node:

docs/developer_versioned_docs/version-v4.3.1/docs/aztec-nr/framework-description/state_variables.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ Note: The `Owned` wrapper requires calling `.at(owner)` to access the underlying
579579

580580
#### `get_notes`
581581

582-
Retrieves notes the account has access to. You can optionally provide filtering options. Returns `RetrievedNote` instances:
582+
Retrieves notes the account has access to. You can optionally provide filtering options. Returns `ConfirmedNote` instances:
583583

584584
```rust title="private_set_get_notes" showLineNumbers
585585
let options = NoteGetterOptions::with_filter(filter_notes_min_sum, amount);
@@ -591,7 +591,7 @@ let notes = owner_balance.get_notes(options);
591591

592592
#### `pop_notes`
593593

594-
This function pops (gets, removes and returns) the notes the account has access to. Unlike `get_notes`, this immediately nullifies the notes and returns them directly (not wrapped in `RetrievedNote`):
594+
This function pops (gets, removes and returns) the notes the account has access to. Unlike `get_notes`, this immediately nullifies the notes and returns them directly (not wrapped in `ConfirmedNote`):
595595

596596
```rust title="private_set_pop_notes" showLineNumbers
597597
let options = NoteGetterOptions::new().set_limit(1);
@@ -602,13 +602,13 @@ let note = owner_balance.pop_notes(options).get(0);
602602

603603
#### `remove`
604604

605-
Will remove a note from the `PrivateSet` if it previously has been read from storage. Takes a `RetrievedNote` as returned by `get_notes`:
605+
Will remove a note from the `PrivateSet` if it previously has been read from storage. Takes a `ConfirmedNote` as returned by `get_notes`:
606606

607607
```rust
608608
let options = NoteGetterOptions::new();
609-
let retrieved_notes = self.storage.balances.at(owner).get_notes(options);
609+
let confirmed_notes = self.storage.balances.at(owner).get_notes(options);
610610
// ... select a note to remove ...
611-
self.storage.balances.at(owner).remove(retrieved_notes.get(0));
611+
self.storage.balances.at(owner).remove(confirmed_notes.get(0));
612612
```
613613

614614
Note that if you obtained the note via `get_notes`, it's much better to use `pop_notes`, as `pop_notes` results in significantly fewer constraints due to avoiding an extra hash and read request check.

docs/developer_versioned_docs/version-v4.3.1/docs/cli/aztec_cli_reference.md

Lines changed: 1404 additions & 169 deletions
Large diffs are not rendered by default.

docs/developer_versioned_docs/version-v4.3.1/docs/cli/aztec_wallet_cli_reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ wallet [options] [command]
6767
**Options:**
6868

6969
- `-V --version` - output the version number
70-
- `-d --data-dir <string>` - Storage directory for wallet data (default: "/home/josh/.aztec/wallet")
70+
- `-d --data-dir <string>` - Storage directory for wallet data (default: "~/.aztec/wallet")
7171
- `-p --prover <string>` - The type of prover the wallet uses (choices: "wasm", "native", "none", default: "native", env: PXE_PROVER)
72-
- `-n --node-url <string>` - URL of the Aztec node to connect to (default: "http://host.docker.internal:8080", env: AZTEC_NODE_URL)
72+
- `-n --node-url <string>` - URL of the Aztec node to connect to (default: "http://localhost:8080", env: AZTEC_NODE_URL)
7373
- `-h --help` - display help for command
7474

7575
### Subcommands

docs/developer_versioned_docs/version-v4.3.1/docs/foundational-topics/contract_creation.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,24 +102,25 @@ Your contract can verify the deployment or initialization state of other contrac
102102
- Conditional logic based on initialization
103103

104104
```rust
105-
use aztec::history::contract_inclusion::{
106-
ProveContractDeployment,
107-
ProveContractNonDeployment,
108-
ProveContractInitialization,
109-
ProveContractNonInitialization,
105+
use aztec::history::deployment::{
106+
assert_contract_bytecode_was_not_published_by,
107+
assert_contract_bytecode_was_published_by,
108+
assert_contract_was_initialized_by,
109+
assert_contract_was_not_initialized_by,
110110
};
111111

112-
// Prove a contract is deployed
113-
header.prove_contract_deployment(contract_address);
112+
// Prove a contract's bytecode was published by a given block
113+
assert_contract_bytecode_was_published_by(block_header, contract_address);
114114

115-
// Prove a contract is NOT deployed
116-
header.prove_contract_non_deployment(contract_address);
115+
// Prove a contract's bytecode was NOT published by a given block
116+
assert_contract_bytecode_was_not_published_by(block_header, contract_address);
117117

118-
// Prove a contract is initialized
119-
header.prove_contract_initialization(contract_address);
118+
// Prove a contract was initialized by a given block
119+
// (init_hash is the contract's initialization hash, obtainable via get_contract_instance)
120+
assert_contract_was_initialized_by(block_header, contract_address, init_hash);
120121

121-
// Prove a contract is NOT initialized
122-
header.prove_contract_non_initialization(contract_address);
122+
// Prove a contract was NOT initialized by a given block
123+
assert_contract_was_not_initialized_by(block_header, contract_address, init_hash);
123124
```
124125

125126
These functions prove inclusion or non-inclusion of the corresponding nullifiers in the nullifier tree at a given block.

docs/developer_versioned_docs/version-v4.3.1/docs/tutorials/contract_tutorials/counter_contract.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ pub contract Counter {
6565

6666
This defines a contract called `Counter`.
6767

68+
:::note Clear the scaffold's placeholder test
69+
The scaffolded `counter_test/src/lib.nr` imports the default contract name (`Main`) we just replaced above, so it now fails to compile. Tests aren't used in this tutorial - replace its contents with a single-line stub so `aztec compile` stays clean:
70+
71+
```rust
72+
// Tests are out of scope for this tutorial. See https://docs.aztec.network/developers/docs/aztec-nr/testing_contracts for examples.
73+
```
74+
75+
:::
76+
6877
## Imports
6978

7079
We need to define some imports.

docs/developer_versioned_docs/version-v4.3.1/docs/tutorials/js_tutorials/token_bridge.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ cd hardhat-aztec-example
3939
yarn add @aztec/aztec.js@4.3.1 @aztec/accounts@4.3.1 @aztec/stdlib@4.3.1 @aztec/wallets@4.3.1 tsx
4040
```
4141

42+
:::note Match the `@aztec/l1-contracts` version
43+
The starter repo pins its `@aztec/l1-contracts` dependency to an older release. In `package.json`, update the tag to match the network version used in this tutorial, then run `yarn install` again:
44+
45+
```json
46+
"@aztec/l1-contracts": "git+https://github.com/AztecProtocol/l1-contracts.git#v4.3.1"
47+
```
48+
49+
The L1 interfaces the portal imports later in this tutorial must match the contracts deployed by your running network.
50+
:::
51+
4252
Now start the local network in another terminal:
4353

4454
```bash
@@ -274,7 +284,7 @@ aztec compile
274284

275285
We have built the L2 NFT contract. This is the L2 representation of an NFT that is locked on the L1 bridge.
276286

277-
The L2 bridge is the contract that talks to the L1 bridge through cross-chain messaging. You can read more about this protocol [here](../../../docs/foundational-topics/ethereum-aztec-messaging/index.md).
287+
The L2 bridge is the contract that talks to the L1 bridge through cross-chain messaging. You can read more about this protocol [here](../../foundational-topics/ethereum-aztec-messaging/index.md).
278288

279289
```mermaid
280290
graph LR
@@ -667,6 +677,19 @@ const inboxAddress = nodeInfo.l1ContractAddresses.inboxAddress.toString();
667677
> <sup><sub><a href="https://github.com/AztecProtocol/aztec-packages/blob/v4.3.1/docs/examples/ts/token_bridge/index.ts#L1-L42" target="_blank" rel="noopener noreferrer">Source code: docs/examples/ts/token_bridge/index.ts#L1-L42</a></sub></sup>
668678
669679

680+
:::warning Adjust the artifact imports for this project's layout
681+
The snippet above comes from the monorepo's runnable example, and its artifact imports point at that repo's layout. In the Hardhat project used in this tutorial, replace the four artifact imports with:
682+
683+
```typescript
684+
import NFTPortal from "../artifacts/contracts/NFTPortal.sol/NFTPortal.json" with { type: "json" };
685+
import SimpleNFT from "../artifacts/contracts/SimpleNFT.sol/SimpleNFT.json" with { type: "json" };
686+
import { NFTBridgeContract } from "../contracts/aztec/artifacts/NFTBridge.js";
687+
import { NFTPunkContract } from "../contracts/aztec/artifacts/NFTPunk.js";
688+
```
689+
690+
`npx hardhat compile` writes the Solidity artifacts to `artifacts/contracts/`, and the `aztec codegen` commands from earlier wrote the TypeScript bindings to `contracts/aztec/artifacts/`. Hardhat artifacts also store the bytecode as a plain string, so in the deployment snippet below use `SimpleNFT.bytecode` and `NFTPortal.bytecode` instead of `.bytecode.object`.
691+
:::
692+
670693
You now have wallets for both chains, correctly connected to their respective chains. Next, deploy the L1 contracts:
671694

672695
```typescript title="deploy_l1_contracts" showLineNumbers
@@ -1021,8 +1044,8 @@ console.log("NFT withdrawn to L1\n");
10211044

10221045
You can now try the whole flow with:
10231046

1024-
```typescript
1025-
npx hardhat run scripts/index.ts --network localhost
1047+
```bash
1048+
npx tsx scripts/index.ts
10261049
```
10271050

10281051
## What You Built

docs/developer_versioned_docs/version-v5.0.0-rc.1/docs/aztec-nr/framework-description/advanced/how_to_retrieve_filter_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ This returns up to `MAX_NOTE_HASH_READ_REQUESTS_PER_CALL` notes without filterin
3333
### Step 2: Retrieve notes from storage
3434

3535
```rust
36-
// Returns BoundedVec<HintedNote<MyNote>, ...>
37-
let hinted_notes = storage.my_notes.at(owner).get_notes(options);
36+
// Returns BoundedVec<ConfirmedNote<MyNote>, ...>
37+
let confirmed_notes = storage.my_notes.at(owner).get_notes(options);
3838
```
3939

4040
:::tip get_notes vs pop_notes

0 commit comments

Comments
 (0)