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
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SHELL ["/bin/bash", "-c"]

ENV NVM_DIR=/root/.nvm
ENV NODE_VERSION=24.12.0
ARG AZTEC_VERSION=5.0.0-rc.1
ARG AZTEC_VERSION=5.0.0-rc.2
ENV AZTEC_VERSION=$AZTEC_VERSION
ENV NON_INTERACTIVE=1
ENV BIN_PATH=/usr/local/bin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/local-network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
env:
AZTEC_ENV: local-network
AZTEC_VERSION: 5.0.0-rc.1
AZTEC_VERSION: 5.0.0-rc.2

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ When answering questions about the Aztec network, protocol, SDK, or tooling, fet

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: `5.0.0-rc.1`** — 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 = "v5.0.0-rc.1", directory = "aztec" }
aztec = { git = "https://github.com/AztecProtocol/aztec-nr/", tag = "v5.0.0-rc.2", directory = "aztec" }
27 changes: 13 additions & 14 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 contracts"
* **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:** `5.0.0-rc.1` (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 @@ -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 Down Expand Up @@ -438,7 +438,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 @@ -522,7 +522,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/5.0.0-rc.1" | VERSION="5.0.0-rc.1" 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 @@ -582,7 +582,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 @@ -607,7 +607,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 @@ -642,7 +642,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 @@ -690,7 +690,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 @@ -711,7 +711,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 @@ -733,7 +733,7 @@ pub unconstrained fn setup() -> (TestEnvironment, AztecAddress, AztecAddress) {
**Aztec toolkit:**

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

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

<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 @@ -51,7 +51,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=5.0.0-rc.1
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": "5.0.0-rc.1"
"version": "5.0.0-rc.2"
},
"timeouts": {
"deployTimeout": 120000,
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 contracts"
- **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:** `5.0.0-rc.1` (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/5.0.0-rc.1" | VERSION="5.0.0-rc.1" 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=5.0.0-rc.1
export VERSION=5.0.0-rc.2
curl -fsSL "https://install.aztec.network/${VERSION}" | VERSION="${VERSION}" bash -s
```

Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
"update-readme-version": "node ./.github/scripts/update-readme-version.js"
},
"dependencies": {
"@aztec/accounts": "5.0.0-rc.1",
"@aztec/aztec.js": "5.0.0-rc.1",
"@aztec/constants": "5.0.0-rc.1",
"@aztec/entrypoints": "5.0.0-rc.1",
"@aztec/noir-contracts.js": "5.0.0-rc.1",
"@aztec/protocol-contracts": "5.0.0-rc.1",
"@aztec/pxe": "5.0.0-rc.1",
"@aztec/stdlib": "5.0.0-rc.1",
"@aztec/wallet-sdk": "5.0.0-rc.1",
"@aztec/wallets": "5.0.0-rc.1",
"@aztec/accounts": "5.0.0-rc.2",
"@aztec/aztec.js": "5.0.0-rc.2",
"@aztec/constants": "5.0.0-rc.2",
"@aztec/entrypoints": "5.0.0-rc.2",
"@aztec/noir-contracts.js": "5.0.0-rc.2",
"@aztec/protocol-contracts": "5.0.0-rc.2",
"@aztec/pxe": "5.0.0-rc.2",
"@aztec/stdlib": "5.0.0-rc.2",
"@aztec/wallet-sdk": "5.0.0-rc.2",
"@aztec/wallets": "5.0.0-rc.2",
"dotenv": "^17.2.2"
},
"devDependencies": {
Expand Down
26 changes: 26 additions & 0 deletions scripts/fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { AztecAddress } from '@aztec/aztec.js/addresses';
import { NO_FROM } from '@aztec/aztec.js/account';
import { getAztecNodeUrl, getTimeouts } from '../config/config.js';
import { GasSettings, Gas } from '@aztec/stdlib/gas';
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';

const MNEMONIC = 'test test test test test test test test test test test junk';
const FEE_FUNDING_FOR_TESTER_ACCOUNT = 1000000000000000000000n;
Expand Down Expand Up @@ -71,6 +72,29 @@ async function main() {
const paymentMethod = new SponsoredFeePaymentMethod(sponsoredFPC.address);
const timeouts = getTimeouts();

// A bridged L1->L2 message only becomes consumable once the sequencer has synced
// the L1 deposit and progressed enough L2 blocks. Progress blocks (by deploying
// arbitrary contracts) until the claim's message is available before claiming.
const feeJuiceAddress = nodeInfo.protocolContractAddresses.feeJuice;
const waitForClaimReady = async (claimToCheck: { messageHash: string, claimSecret: Fr }) => {
const isReady = async () => !!(await getNonNullifiedL1ToL2MessageWitness(
node,
feeJuiceAddress,
Fr.fromHexString(claimToCheck.messageHash),
claimToCheck.claimSecret,
).catch(() => undefined));
for (let attempt = 0; attempt < 10 && !(await isReady()); attempt++) {
await PodRacingContract.deploy(wallet, account1.address).send({
from: account1.address,
fee: { paymentMethod },
wait: { timeout: timeouts.deployTimeout }
});
}
if (!(await isReady())) {
throw new Error('L1->L2 message did not become available after progressing blocks');
}
};

// Two arbitrary txs to make the L1 message available on L2
// Simulate before sending to surface revert reasons
const podRacingDeploy = PodRacingContract.deploy(wallet, account1.address);
Expand All @@ -91,6 +115,7 @@ async function main() {

// Claim Fee Juice & Pay Fees yourself

await waitForClaimReady(claim);
const claimAndPay = new FeeJuicePaymentMethodWithClaim(account2.address, claim);
const deployMethod = await account2.getDeployMethod();
await deployMethod.send({ from: NO_FROM, fee: { paymentMethod: claimAndPay }, wait: { timeout: timeouts.deployTimeout } });
Expand Down Expand Up @@ -146,6 +171,7 @@ async function main() {
await wallet.registerContract(feeJuiceInstance.instance, FeeJuiceContract.artifact);
const feeJuice = await FeeJuiceContract.at(feeJuiceInstance.address, wallet);

await waitForClaimReady(fpcClaim);
await feeJuice.methods.claim(fpc.address, fpcClaim.claimAmount, fpcClaim.claimSecret, fpcClaim.messageLeafIndex).send({ from: account2.address, wait: { timeout: timeouts.txTimeout } });

logger.info(`Fpc fee juice balance ${(await feeJuice.methods.balance_of_public(fpc.address).simulate({
Expand Down
6 changes: 3 additions & 3 deletions scripts/interaction_existing_contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,20 @@ async function main() {
.trim() // Remove leading/trailing whitespace
.replace(/^['"]|['"]$/g, ''); // Remove surrounding quotes from .env parsing

constructorArgs = JSON.parse(cleanedJson).map((arg: string) => AztecAddress.fromString(arg));
constructorArgs = JSON.parse(cleanedJson).map((arg: string) => AztecAddress.fromStringUnsafe(arg));
} catch (error) {
logger.error(`Failed to parse constructor args: ${constructorArgsJson}`);
logger.error(`Error: ${error}`);
throw error;
}

// Reconstruct contract instance
const podRacingContractAddress = AztecAddress.fromString(contractAddress);
const podRacingContractAddress = AztecAddress.fromStringUnsafe(contractAddress);

const instance = await getContractInstanceFromInstantiationParams(PodRacingContract.artifact, {
constructorArgs,
salt: Fr.fromString(contractSalt),
deployer: AztecAddress.fromString(contractDeployer)
deployer: AztecAddress.fromStringUnsafe(contractDeployer)
});

logger.info("✅ Contract instance reconstructed successfully");
Expand Down
46 changes: 30 additions & 16 deletions src/test/e2e/accounts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { AztecAddress } from "@aztec/aztec.js/addresses";
import { NO_FROM } from "@aztec/aztec.js/account";
import { type Logger, createLogger } from "@aztec/foundation/log";
import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from "@aztec/aztec.js/contracts";
import { getNonNullifiedL1ToL2MessageWitness } from "@aztec/stdlib/messaging";
import { Fr } from "@aztec/aztec.js/fields";
import { GrumpkinScalar } from "@aztec/foundation/curves/grumpkin";
import { ContractDeployer } from "@aztec/aztec.js/deployment";
Expand Down Expand Up @@ -116,22 +117,35 @@ describe("Accounts", () => {
}
console.log(`Total claims created: ${claims.length}`);

// arbitrary transactions to progress 2 blocks, and have fee juice on Aztec ready to claim
console.log('Deploying first PodRacingContract to progress blocks...');
await PodRacingContract.deploy(wallet, ownerAccount.address).send({
from: ownerAccount.address,
fee: { paymentMethod: sponsoredPaymentMethod },
wait: { timeout: getTimeouts().deployTimeout }
});
console.log('First PodRacingContract deployed');

console.log('Deploying second PodRacingContract to progress blocks...');
await PodRacingContract.deploy(wallet, ownerAccount.address).send({
from: ownerAccount.address,
fee: { paymentMethod: sponsoredPaymentMethod },
wait: { timeout: getTimeouts().deployTimeout }
});
console.log('Second PodRacingContract deployed');
// The bridged L1->L2 messages only become consumable once the sequencer has
// synced the L1 deposits and progressed enough L2 blocks. Progress blocks (by
// deploying arbitrary contracts) until every claim's message is available on L2.
const messagesAvailable = async () => {
for (const claim of claims) {
const witness = await getNonNullifiedL1ToL2MessageWitness(
node,
feeJuiceAddress,
Fr.fromHexString(claim.messageHash),
claim.claimSecret,
).catch(() => undefined);
if (!witness) return false;
}
return true;
};

console.log('Progressing blocks until L1->L2 messages are available...');
for (let attempt = 0; attempt < 10 && !(await messagesAvailable()); attempt++) {
console.log(`Deploying PodRacingContract to progress blocks (attempt ${attempt + 1})...`);
await PodRacingContract.deploy(wallet, ownerAccount.address).send({
from: ownerAccount.address,
fee: { paymentMethod: sponsoredPaymentMethod },
wait: { timeout: getTimeouts().deployTimeout }
});
}
if (!(await messagesAvailable())) {
throw new Error('L1->L2 messages did not become available after progressing blocks');
}
console.log('L1->L2 messages available on L2');

// Now deploy random accounts using FeeJuicePaymentMethodWithClaim (which claims and pays in one tx)
console.log('Starting account deployments with FeeJuicePaymentMethodWithClaim...');
Expand Down
Loading
Loading