Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/local-network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
run: |
echo "$HOME/.aztec/current/bin" >> $GITHUB_PATH
echo "$HOME/.aztec/current/node_modules/.bin" >> $GITHUB_PATH
echo "$HOME/.aztec/current/internal-bin" >> $GITHUB_PATH
echo "$HOME/.aztec/bin" >> $GITHUB_PATH

- name: Start local Aztec network
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

Aztec Starter — a Pod Racing game contract built with Noir on the Aztec network. Two players allocate points across 5 tracks over 3 rounds with private state; scores are revealed at the end (commit-reveal pattern). The player who wins more tracks (best of 5) wins.

**Aztec version: `4.1.0`** — pinned across `Nargo.toml`, `package.json`, `config/*.json`, and README. All must stay in sync when updating.
**Aztec version: `5.0.0-rc.2`** — pinned across `Nargo.toml`, `package.json`, `config/*.json`, and README. All must stay in sync when updating.

## Build & Development Commands

Expand Down
2 changes: 1 addition & 1 deletion Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = [ "" ]
compiler_version = ">=0.18.0"

[dependencies]
aztec = { git = "https://github.com/AztecProtocol/aztec-nr/", tag = "v4.1.0", directory = "aztec" }
aztec = { git = "https://github.com/AztecProtocol/aztec-nr/", tag = "v5.0.0-rc.2", directory = "aztec" }
45 changes: 22 additions & 23 deletions ONBOARDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This guide takes you from "reading code in a browser" to "deploying on devnet"
* **Phases 1-2** need only a browser (read code, compile in a Codespace)
* **Phases 3-6** need local tools (deploy, interact, extend, advanced topics)

**Aztec version pinned in this repo:** `4.1.0` (check `Nargo.toml` and `package.json` for source of truth)
**Aztec version pinned in this repo:** `5.0.0-rc.2` (check `Nargo.toml` and `package.json` for source of truth)

**Links:**

Expand Down Expand Up @@ -101,7 +101,7 @@ struct Storage<Context> {
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/main.nr#L40-L59" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Lstorage</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/main.nr#L40-L59" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Lstorage</a></sub></sup>

**What is `Context`?** You'll notice `Context` appears as a generic parameter throughout the storage definition. In Aztec, the context is the execution environment passed to every function — it's how your contract accesses blockchain state like `context.msg_sender()` (the caller's address) and `context.block_number()`. Think of it as an expanded version of Solidity's global variables (`msg.sender`, `block.number`, etc.), but packaged as an object. The `<Context>` generic on storage types lets the same storage struct work in both public and private execution contexts. You don't need to construct it yourself — the framework provides `self.context` automatically in every contract function.

Expand Down Expand Up @@ -149,7 +149,7 @@ fn constructor(admin: AztecAddress) {
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/main.nr#L61-L68" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Lconstructor</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/main.nr#L61-L68" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Lconstructor</a></sub></sup>

Sets the admin address. The `#[initializer]` macro means this runs once at deployment, like a Solidity constructor.

Expand Down Expand Up @@ -180,7 +180,7 @@ fn create_game(game_id: Field) {
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/main.nr#L70-L93" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Lcreate-game</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/main.nr#L70-L93" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Lcreate-game</a></sub></sup>

Creates a new game. Checks the game ID isn't taken (player1 must be zero address), then writes a new `Race` struct with the caller as player1 and an expiration time.

Expand All @@ -202,7 +202,7 @@ fn join_game(game_id: Field) {
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/main.nr#L95-L109" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Ljoin-game</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/main.nr#L95-L109" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Ljoin-game</a></sub></sup>

A second player joins. The `Race::join()` method validates that player1 exists, the player2 slot is empty, and the joiner isn't player1.

Expand Down Expand Up @@ -236,7 +236,7 @@ fn finalize_game(game_id: Field) {
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/main.nr#L269-L296" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Lfinalize-game</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/main.nr#L269-L296" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Lfinalize-game</a></sub></sup>

After both players have revealed, this compares track scores, determines the winner, and updates the leaderboard.

Expand Down Expand Up @@ -280,7 +280,7 @@ pub struct Race {
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/race.nr#L7-L41" target="_blank" rel="noopener noreferrer">Source code: /src/race.nr#Lrace-struct</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/race.nr#L7-L41" target="_blank" rel="noopener noreferrer">Source code: /src/race.nr#Lrace-struct</a></sub></sup>

Key methods:

Expand Down Expand Up @@ -332,7 +332,7 @@ fn play_round(
.at(game_id)
.at(player)
.insert(GameRoundNote::new(track1, track2, track3, track4, track5, round, player))
.deliver(MessageDelivery.ONCHAIN_CONSTRAINED);
.deliver(MessageDelivery::onchain_constrained());

// Enqueue a public function call to update the round counter
// This reveals that a round was played, but not the point allocation
Expand All @@ -344,7 +344,7 @@ fn play_round(
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/main.nr#L111-L160" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Lplay-round</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/main.nr#L111-L160" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Lplay-round</a></sub></sup>

Three things happen here that have no direct Ethereum equivalent:

Expand Down Expand Up @@ -406,7 +406,7 @@ fn finish_game(game_id: Field) {
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/main.nr#L179-L230" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Lfinish-game</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/main.nr#L179-L230" target="_blank" rel="noopener noreferrer">Source code: /src/main.nr#Lfinish-game</a></sub></sup>

This is the "reveal" phase:

Expand Down Expand Up @@ -442,7 +442,7 @@ pub struct GameRoundNote {
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/game_round_note.nr#L3-L29" target="_blank" rel="noopener noreferrer">Source code: /src/game_round_note.nr#Lgame-round-note</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/game_round_note.nr#L3-L29" target="_blank" rel="noopener noreferrer">Source code: /src/game_round_note.nr#Lgame-round-note</a></sub></sup>

The `#[note]` macro makes this a private state primitive. Each note stores one round's point allocation and the owner's address. Only the owner can read it.

Expand Down Expand Up @@ -526,7 +526,7 @@ The `.devcontainer/` configures:

* **Base image:** Ubuntu 24.04 with Node.js v22.15.0
* **Docker-in-Docker** for running the Aztec local network
* **Aztec CLI** installed via `curl -fsSL "https://install.aztec.network/4.1.0" | VERSION="4.1.0" bash -s`
* **Aztec CLI** installed via `curl -fsSL "https://install.aztec.network/5.0.0-rc.2" | VERSION="5.0.0-rc.2" bash -s`
* **VS Code extension:** `noir-lang.vscode-noir` for Noir syntax highlighting
* **Dependencies:** `yarn install` runs automatically

Expand Down Expand Up @@ -586,7 +586,7 @@ unconstrained fn test_initializer() {
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/test/pod_racing.nr#L9-L20" target="_blank" rel="noopener noreferrer">Source code: /src/test/pod_racing.nr#Ltest-initializer</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/test/pod_racing.nr#L9-L20" target="_blank" rel="noopener noreferrer">Source code: /src/test/pod_racing.nr#Ltest-initializer</a></sub></sup>

The `unconstrained` keyword means this test runs outside the ZK circuit (it's a test, not a provable function). `utils::setup()` deploys a fresh contract and returns the environment, contract address, and admin.

Expand All @@ -611,7 +611,7 @@ unconstrained fn test_fail_play_round_too_many_points() {
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/test/pod_racing.nr#L140-L157" target="_blank" rel="noopener noreferrer">Source code: /src/test/pod_racing.nr#Ltest-fail-too-many-points</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/test/pod_racing.nr#L140-L157" target="_blank" rel="noopener noreferrer">Source code: /src/test/pod_racing.nr#Ltest-fail-too-many-points</a></sub></sup>

The `#[test(should_fail)]` attribute is like Foundry's `vm.expectRevert()`.

Expand Down Expand Up @@ -646,7 +646,7 @@ pub unconstrained fn max_allocation() -> (u8, u8, u8, u8, u8) {
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/test/helpers.nr#L18-L39" target="_blank" rel="noopener noreferrer">Source code: /src/test/helpers.nr#Lallocation-strategies</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/test/helpers.nr#L18-L39" target="_blank" rel="noopener noreferrer">Source code: /src/test/helpers.nr#Lallocation-strategies</a></sub></sup>

And higher-level helpers:

Expand Down Expand Up @@ -694,7 +694,7 @@ pub unconstrained fn play_all_rounds_with_strategy(
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/test/helpers.nr#L41-L83" target="_blank" rel="noopener noreferrer">Source code: /src/test/helpers.nr#Lsetup-helpers</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/test/helpers.nr#L41-L83" target="_blank" rel="noopener noreferrer">Source code: /src/test/helpers.nr#Lsetup-helpers</a></sub></sup>

#### Test setup (`src/test/utils.nr`)

Expand All @@ -715,7 +715,7 @@ pub unconstrained fn setup() -> (TestEnvironment, AztecAddress, AztecAddress) {
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/test/utils.nr#L7-L22" target="_blank" rel="noopener noreferrer">Source code: /src/test/utils.nr#Ltest-setup</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/test/utils.nr#L7-L22" target="_blank" rel="noopener noreferrer">Source code: /src/test/utils.nr#Ltest-setup</a></sub></sup>

**Ethereum analogies:**

Expand All @@ -737,7 +737,7 @@ pub unconstrained fn setup() -> (TestEnvironment, AztecAddress, AztecAddress) {
**Aztec toolkit:**

```bash
export VERSION=4.1.0
export VERSION=5.0.0-rc.2
curl -fsSL "https://install.aztec.network/${VERSION}" | VERSION="${VERSION}" bash -s
```

Expand Down Expand Up @@ -849,7 +849,7 @@ export async function getSponsoredFPCInstance(): Promise<ContractInstanceWithAdd
}
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/utils/sponsored_fpc.ts#L11-L17" target="_blank" rel="noopener noreferrer">Source code: /src/utils/sponsored_fpc.ts#Lget-sponsored-fpc</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/src/utils/sponsored_fpc.ts#L11-L17" target="_blank" rel="noopener noreferrer">Source code: /src/utils/sponsored_fpc.ts#Lget-sponsored-fpc</a></sub></sup>

**Run it:**

Expand Down Expand Up @@ -880,15 +880,14 @@ const deployRequest = PodRacingContract.deploy(wallet, address);
await deployRequest.simulate({
from: address,
});
const { receipt } = await deployRequest.send({
const { contract: podRacingContract, instance } = await deployRequest.send({
from: address,
fee: { paymentMethod: sponsoredPaymentMethod },
wait: { timeout: timeouts.deployTimeout, returnReceipt: true }
wait: { timeout: timeouts.deployTimeout }
});
const podRacingContract = receipt.contract;
```

<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/scripts/deploy_contract.ts#L44-L55" target="_blank" rel="noopener noreferrer">Source code: /scripts/deploy_contract.ts#Ldeploy-contract</a></sub></sup>
<sup><sub><a href="https://github.com/AztecProtocol/aztec-starter/blob/main/scripts/deploy_contract.ts#L44-L54" target="_blank" rel="noopener noreferrer">Source code: /scripts/deploy_contract.ts#Ldeploy-contract</a></sub></sup>

> **Important:** Always call `.simulate()` before `.send()`. Simulation runs the transaction locally and surfaces revert reasons immediately. Without it, a failing transaction hangs until timeout with an opaque error.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Use **Node.js version 22.15.0**.
Install the **Aztec toolkit** (local network, CLI, and other tooling) at the correct version:

```bash
export VERSION=4.1.0
export VERSION=5.0.0-rc.2
curl -fsSL "https://install.aztec.network/${VERSION}" | VERSION="${VERSION}" bash -s
```

Expand Down
2 changes: 1 addition & 1 deletion config/local-network.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"settings": {
"skipLocalNetwork": false,
"version": "4.1.0"
"version": "5.0.0-rc.2"
},
"timeouts": {
"deployTimeout": 120000,
Expand Down
4 changes: 2 additions & 2 deletions config/testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"name": "testnet",
"environment": "testnet",
"network": {
"nodeUrl": "https://rpc.testnet.aztec-labs.com",
"nodeUrl": "https://v5.testnet.rpc.aztec-labs.com",
"l1RpcUrl": "https://ethereum-sepolia-rpc.publicnode.com",
"l1ChainId": 11155111
},
"settings": {
"skipLocalNetwork": true,
"version": "4.1.0"
"version": "5.0.0-rc.2"
},
"timeouts": {
"deployTimeout": 1200000,
Expand Down
6 changes: 3 additions & 3 deletions docs/ONBOARDING.src.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This guide takes you from "reading code in a browser" to "deploying on devnet"
- **Phases 1-2** need only a browser (read code, compile in a Codespace)
- **Phases 3-6** need local tools (deploy, interact, extend, advanced topics)

**Aztec version pinned in this repo:** `4.1.0` (check `Nargo.toml` and `package.json` for source of truth)
**Aztec version pinned in this repo:** `5.0.0-rc.2` (check `Nargo.toml` and `package.json` for source of truth)

**Links:**

Expand Down Expand Up @@ -262,7 +262,7 @@ The `.devcontainer/` configures:

- **Base image:** Ubuntu 24.04 with Node.js v22.15.0
- **Docker-in-Docker** for running the Aztec local network
- **Aztec CLI** installed via `curl -fsSL "https://install.aztec.network/4.1.0" | VERSION="4.1.0" bash -s`
- **Aztec CLI** installed via `curl -fsSL "https://install.aztec.network/5.0.0-rc.2" | VERSION="5.0.0-rc.2" bash -s`
- **VS Code extension:** `noir-lang.vscode-noir` for Noir syntax highlighting
- **Dependencies:** `yarn install` runs automatically

Expand Down Expand Up @@ -357,7 +357,7 @@ And higher-level helpers:
**Aztec toolkit:**

```bash
export VERSION=4.1.0
export VERSION=5.0.0-rc.2
curl -fsSL "https://install.aztec.network/${VERSION}" | VERSION="${VERSION}" bash -s
```

Expand Down
Loading
Loading