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=22.15.0
ARG AZTEC_VERSION=4.0.0-devnet.1-patch.0
ARG AZTEC_VERSION=4.0.0-devnet.2-patch.1
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: 4.0.0-nightly.20260211
AZTEC_VERSION: 4.0.0-devnet.2-patch.1

steps:
- name: Checkout repository
Expand Down
15 changes: 11 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
# Repository guidelines for Codex agents

This repository contains TypeScript scripts and Noir contracts for the Aztec local network.
This repository contains TypeScript scripts and Noir contracts for the Aztec network.
Follow these guidelines when contributing:

## Setup
- Use **Node.js v22** with Yarn.
- Install dependencies with `yarn install`.
- Start the Aztec local network using `aztec start --local-network` before running tests or scripts.
- The Aztec CLI (`aztec`) must be installed at the version matching `Nargo.toml` and `package.json`.
- Start the Aztec local network with `aztec start --local-network` before running E2E tests or scripts. This is **not** needed for compilation or Noir unit tests.
- After restarting the local network, always run `rm -rf ./store` to clear stale PXE data.

## Development
- This is an ESM project (`"type": "module"` in `package.json`).
- Compile contracts with `yarn compile` and generate TypeScript artifacts with `yarn codegen`.
- Use four spaces for indentation in TypeScript and scripts.
- Do not commit generated artifacts (`src/artifacts`, `target`, or `store` folders).
- Never edit `src/artifacts/PodRacing.ts` directly; it is generated by `yarn codegen`.
- To target devnet instead of local network, set `AZTEC_ENV=devnet` (e.g. `AZTEC_ENV=devnet yarn deploy`).

## Testing
- Run `yarn test` and ensure it passes before committing. This runs both the TypeScript tests and Noir tests.
There are two independent test systems:
- **Noir TXE tests** (`yarn test:nr`): Run in the TXE simulator, no network required.
- **TypeScript E2E tests** (`yarn test:js`): Require a running local network.
- `yarn test` runs both. Ensure tests pass before committing.

## Pull Requests
- Use clear commit messages and provide a concise description in the PR body about the change.
- Mention which tests were executed.

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.0.0-devnet.1-patch.0", directory = "aztec" }
aztec = { git = "https://github.com/AztecProtocol/aztec-nr/", tag = "v4.0.0-devnet.2-patch.1", directory = "aztec" }
39 changes: 11 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,11 @@ Use **Node.js version 22.15.0**.

[Start your codespace from the codespace dropdown](https://docs.github.com/en/codespaces/getting-started/quickstart).

Get the **local network, aztec-cli, and other tooling** with this command:
Install the **Aztec toolkit** (local network, CLI, and other tooling) at the correct version:

```bash
bash -i <(curl -s https://install.aztec.network)
```

Install the correct version of the toolkit with:

```bash
export VERSION=4.0.0-devnet.1-patch.0
aztec-up && docker pull aztecprotocol/aztec:$VERSION && docker tag aztecprotocol/aztec:$VERSION aztecprotocol/aztec:latest
export VERSION=4.0.0-devnet.2-patch.1
curl -fsSL "https://install.aztec.network/${VERSION}" | VERSION="${VERSION}" bash -s
```

### Environment Configuration
Expand All @@ -58,7 +52,7 @@ This project uses JSON configuration files to manage environment-specific settin
- `config/local-network.json` - Configuration for local network development
- `config/devnet.json` - Configuration for devnet deployment

The system automatically loads the appropriate configuration file based on the `ENV` environment variable. If `ENV` is not set, it defaults to `local-network`.
The system automatically loads the appropriate configuration file based on the `AZTEC_ENV` environment variable. If `AZTEC_ENV` is not set, it defaults to `local-network`.

The configuration files contain network URLs, timeouts, and environment-specific settings. You can modify these files to customize your development environment.

Expand Down Expand Up @@ -89,7 +83,7 @@ yarn deploy-account::devnet # Deploy account to devnet
yarn interaction-existing-contract::devnet # Interact with devnet contracts
```

The `::devnet` suffix automatically sets `ENV=devnet`, loading configuration from `config/devnet.json`.
The `::devnet` suffix automatically sets `AZTEC_ENV=devnet`, loading configuration from `config/devnet.json`.

---

Expand Down Expand Up @@ -163,9 +157,9 @@ Then test with:
yarn test
```

Testing will run the **TypeScript tests** defined in `index.test.ts` inside `./src/test/e2e`, as well as the [Aztec Testing eXecution Environment (TXE)](https://docs.aztec.network/developers/guides/smart_contracts/testing) tests defined in [`first.nr`](./src/test/first.nr) (imported in the contract file with `mod test;`).
Testing will run the **TypeScript E2E tests** defined in `./src/test/e2e/`, as well as the [Aztec Testing eXecution Environment (TXE)](https://docs.aztec.network/developers/guides/smart_contracts/testing) tests defined in [`./src/test/`](./src/test/) (imported in the contract file with `mod test;`).

Note: The Typescript tests spawn an instance of the local network to test against, and close it once the TS tests are complete.
Note: The TypeScript tests require a running local network. The Noir TXE tests (`yarn test:nr`) run without a network.

---

Expand All @@ -186,7 +180,7 @@ You can find a handful of scripts in the `./scripts` folder.
The `./src/utils/` folder contains utility functions:

- `./src/utils/create_account_from_env.ts` provides functions to create Schnorr accounts from environment variables (SECRET, SIGNING_KEY, and SALT), useful for account management across different environments.
- `./src/utils/setup_wallet.ts` provides a function to set up and configure the TestWallet with proper configuration based on the environment.
- `./src/utils/setup_wallet.ts` provides a function to set up and configure the EmbeddedWallet with proper configuration based on the environment.
- `./src/utils/deploy_account.ts` provides a function to deploy Schnorr accounts to the network with sponsored fee payment, including key generation and deployment verification.
- `./src/utils/sponsored_fpc.ts` provides functions to deploy and manage the SponsoredFPC (Fee Payment Contract) for handling sponsored transaction fees.
- `./config/config.ts` provides environment-aware configuration loading, automatically selecting the correct JSON config file based on the `ENV` variable.
Expand All @@ -195,24 +189,13 @@ The `./src/utils/` folder contains utility functions:

:warning: Tests and scripts set up and run the Private Execution Environment (PXE) and store PXE data in the `./store` directory. If you restart the local network, you will need to delete the `./store` directory to avoid errors.

### 🔄 **Update Node.js and Noir Dependencies**

```bash
yarn update
```

### 🔄 **Update Contract**

Get the **contract code from the monorepo**. The script will look at the versions defined in `./Nargo.toml` and fetch that version of the code from the monorepo.

```bash
yarn update
```
### 🔄 **Update Contract from Monorepo**

You may need to update permissions with:
Get the **contract code from the monorepo**. The script will look at the versions defined in `./Nargo.toml` and fetch that version of the code from the monorepo:

```bash
chmod +x .github/scripts/update_contract.sh
.github/scripts/update_contract.sh <version-tag>
```

## AI Agent Contributor Guide
Expand Down
4 changes: 2 additions & 2 deletions config/devnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"name": "devnet",
"environment": "devnet",
"network": {
"nodeUrl": "https://v4-devnet-1.aztec-labs.com",
"nodeUrl": "https://v4-devnet-2.aztec-labs.com",
"l1RpcUrl": "https://ethereum-sepolia-rpc.publicnode.com",
"l1ChainId": 11155111
},
"settings": {
"skipLocalNetwork": true,
"version": "4.0.0-devnet.1-patch.0"
"version": "4.0.0-devnet.2-patch.1"
},
"timeouts": {
"deployTimeout": 1200000,
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.0.0-devnet.1-patch.0"
"version": "4.0.0-devnet.2-patch.1"
},
"timeouts": {
"deployTimeout": 120000,
Expand Down
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@
"update-readme-version": "node ./.github/scripts/update-readme-version.js"
},
"dependencies": {
"@aztec/accounts": "4.0.0-devnet.1-patch.0",
"@aztec/aztec.js": "4.0.0-devnet.1-patch.0",
"@aztec/noir-contracts.js": "4.0.0-devnet.1-patch.0",
"@aztec/protocol-contracts": "4.0.0-devnet.1-patch.0",
"@aztec/pxe": "4.0.0-devnet.1-patch.0",
"@aztec/stdlib": "4.0.0-devnet.1-patch.0",
"@aztec/test-wallet": "4.0.0-devnet.1-patch.0",
"@aztec/accounts": "4.0.0-devnet.2-patch.1",
"@aztec/aztec.js": "4.0.0-devnet.2-patch.1",
"@aztec/constants": "4.0.0-devnet.2-patch.1",
"@aztec/entrypoints": "4.0.0-devnet.2-patch.1",
"@aztec/noir-contracts.js": "4.0.0-devnet.2-patch.1",
"@aztec/protocol-contracts": "4.0.0-devnet.2-patch.1",
"@aztec/pxe": "4.0.0-devnet.2-patch.1",
"@aztec/stdlib": "4.0.0-devnet.2-patch.1",
"@aztec/wallet-sdk": "4.0.0-devnet.2-patch.1",
"@aztec/wallets": "4.0.0-devnet.2-patch.1",
"dotenv": "^17.2.2"
},
"devDependencies": {
Expand Down
38 changes: 7 additions & 31 deletions scripts/multiple_wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,11 @@ import { createAztecNodeClient } from "@aztec/aztec.js/node";
import { TokenContract } from "@aztec/noir-contracts.js/Token"
import { getSponsoredFPCInstance } from "../src/utils/sponsored_fpc.js";
import { SponsoredFPCContractArtifact } from "@aztec/noir-contracts.js/SponsoredFPC";
import { getPXEConfig } from "@aztec/pxe/config";
import { createStore } from "@aztec/kv-store/lmdb"
import { getEnv, getAztecNodeUrl, getTimeouts } from "../config/config.js";
import { TestWallet } from "@aztec/test-wallet/server";
import { getAztecNodeUrl, getTimeouts } from "../config/config.js";
import { EmbeddedWallet } from "@aztec/wallets/embedded";

const nodeUrl = getAztecNodeUrl();
const node = createAztecNodeClient(nodeUrl)
const l1Contracts = await node.getL1ContractAddresses();
const config = getPXEConfig()
const fullConfig = { ...config, l1Contracts }
fullConfig.proverEnabled = getEnv() !== 'local-network';

const store1 = await createStore('pxe1', {
dataDirectory: 'store',
dataStoreMapSizeKb: 1e6,
});

const store2 = await createStore('pxe2', {
dataDirectory: 'store',
dataStoreMapSizeKb: 1e6,
});

const setupWallet1 = async () => {
return await TestWallet.create(node, fullConfig, { store: store1 });
};

const setupWallet2 = async () => {
return await TestWallet.create(node, fullConfig, { store: store2 });
};
const node = createAztecNodeClient(nodeUrl);

const L2_TOKEN_CONTRACT_SALT = Fr.random();

Expand All @@ -57,8 +33,8 @@ export async function getL2TokenContractInstance(deployerAddress: any, ownerAzte

async function main() {

const wallet1 = await setupWallet1();
const wallet2 = await setupWallet2();
const wallet1 = await EmbeddedWallet.create(node, { ephemeral: true });
const wallet2 = await EmbeddedWallet.create(node, { ephemeral: true });
const sponsoredFPC = await getSponsoredFPCInstance();
await wallet1.registerContract(sponsoredFPC, SponsoredFPCContractArtifact);
await wallet2.registerContract(sponsoredFPC, SponsoredFPCContractArtifact);
Expand All @@ -83,7 +59,7 @@ async function main() {

// setup account on 2nd pxe

await wallet2.registerSender(ownerAddress)
await wallet2.registerSender(ownerAddress, '')

let secretKey2 = Fr.random();
let signingKey2 = GrumpkinScalar.random();
Expand All @@ -94,7 +70,7 @@ async function main() {
const deployMethod2 = await schnorrAccount2.getDeployMethod();
await deployMethod2.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: { timeout: timeouts.deployTimeout } });
let wallet2Address = schnorrAccount2.address;
await wallet2.registerSender(ownerAddress)
await wallet2.registerSender(ownerAddress, '')

// mint to account on 2nd pxe

Expand Down
2 changes: 1 addition & 1 deletion src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub contract PodRacing {
macros::{functions::{external, initializer, only_self}, storage::storage},
messages::message_delivery::MessageDelivery,
note::note_getter_options::NoteGetterOptions,
oracle::debug_log::debug_log_format,
oracle::logging::debug_log_format,
};
use ::aztec::protocol::{address::AztecAddress, traits::ToField};
use ::aztec::state_vars::{Map, Owned, PrivateSet, PublicMutable};
Expand Down
4 changes: 2 additions & 2 deletions src/test/e2e/accounts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { setupWallet } from "../../utils/setup_wallet.js";
import { SponsoredFPCContractArtifact } from "@aztec/noir-contracts.js/SponsoredFPC";
import { FeeJuiceContract } from "@aztec/noir-contracts.js/FeeJuice";
import { getAztecNodeUrl, getEnv, getL1RpcUrl, getTimeouts } from "../../../config/config.js";
import { TestWallet } from "@aztec/test-wallet/server";
import { EmbeddedWallet } from "@aztec/wallets/embedded";
import { type AztecNode, createAztecNodeClient } from "@aztec/aztec.js/node";
import { L1FeeJuicePortalManager, type L2AmountClaim } from "@aztec/aztec.js/ethereum";
import { AztecAddress } from "@aztec/aztec.js/addresses";
Expand All @@ -22,7 +22,7 @@ import { AccountManager } from "@aztec/aztec.js/wallet";
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';

describe("Accounts", () => {
let wallet: TestWallet;
let wallet: EmbeddedWallet;
let logger: Logger;
let sponsoredFPC: ContractInstanceWithAddress;
let sponsoredPaymentMethod: SponsoredFeePaymentMethod;
Expand Down
8 changes: 4 additions & 4 deletions src/test/e2e/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { type ContractInstanceWithAddress } from "@aztec/aztec.js/contracts";
import { Fr } from "@aztec/aztec.js/fields";
import { GrumpkinScalar } from "@aztec/foundation/curves/grumpkin";
import { TxStatus } from "@aztec/stdlib/tx";
import { TestWallet } from '@aztec/test-wallet/server';
import { EmbeddedWallet } from '@aztec/wallets/embedded';
import { AccountManager } from "@aztec/aztec.js/wallet";

// Test constants
Expand Down Expand Up @@ -89,7 +89,7 @@ describe("Pod Racing Game", () => {
let logger: Logger;
let sponsoredFPC: ContractInstanceWithAddress;
let sponsoredPaymentMethod: SponsoredFeePaymentMethod;
let wallet: TestWallet;
let wallet: EmbeddedWallet;
let player1Account: AccountManager;
let player2Account: AccountManager;
let contract: PodRacingContract;
Expand Down Expand Up @@ -125,8 +125,8 @@ describe("Pod Racing Game", () => {
wait: { timeout: getTimeouts().deployTimeout }
});

await wallet.registerSender(player1Account.address);
await wallet.registerSender(player2Account.address);
await wallet.registerSender(player1Account.address, 'player1');
await wallet.registerSender(player2Account.address, 'player2');
logger.info('Player accounts created and registered');

// Deploy the contract once for all tests
Expand Down
10 changes: 5 additions & 5 deletions src/test/e2e/public_logging.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Test to verify public function debug logging works
//
// NOTE: When using TestWallet with a remote node, simulation is forwarded to the node.
// NOTE: When using EmbeddedWallet with a remote node, simulation is forwarded to the node.
// The debug_log_format output appears in the NODE's logs, not in this test's output.
//
// To see debug logs:
Expand All @@ -20,14 +20,14 @@ import { type Logger, createLogger } from "@aztec/foundation/log";
import { type ContractInstanceWithAddress } from "@aztec/aztec.js/contracts";
import { Fr } from "@aztec/aztec.js/fields";
import { GrumpkinScalar } from "@aztec/foundation/curves/grumpkin";
import { TestWallet } from '@aztec/test-wallet/server';
import { EmbeddedWallet } from '@aztec/wallets/embedded';
import { AccountManager } from "@aztec/aztec.js/wallet";

describe("Public Function Logging", () => {
let logger: Logger;
let sponsoredFPC: ContractInstanceWithAddress;
let sponsoredPaymentMethod: SponsoredFeePaymentMethod;
let wallet: TestWallet;
let wallet: EmbeddedWallet;
let player1Account: AccountManager;
let player2Account: AccountManager;
let contract: PodRacingContract;
Expand Down Expand Up @@ -63,8 +63,8 @@ describe("Public Function Logging", () => {
wait: { timeout: getTimeouts().deployTimeout }
});

await wallet.registerSender(player1Account.address);
await wallet.registerSender(player2Account.address);
await wallet.registerSender(player1Account.address, 'player1');
await wallet.registerSender(player2Account.address, 'player2');
logger.info('Player accounts created and registered');

// Deploy the contract
Expand Down
6 changes: 3 additions & 3 deletions src/utils/create_account_from_env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { type Logger, createLogger } from "@aztec/foundation/log";
import { AccountManager } from "@aztec/aztec.js/wallet";
import { setupWallet } from "./setup_wallet.js";
import * as dotenv from 'dotenv';
import { TestWallet } from "@aztec/test-wallet/server";
import { EmbeddedWallet } from "@aztec/wallets/embedded";

// Load environment variables
dotenv.config();

export async function createAccountFromEnv(wallet: TestWallet): Promise<AccountManager> {
export async function createAccountFromEnv(wallet: EmbeddedWallet): Promise<AccountManager> {
let logger: Logger;
logger = createLogger('aztec:create-account');

Expand Down Expand Up @@ -77,6 +77,6 @@ export async function createAccountFromEnv(wallet: TestWallet): Promise<AccountM
return schnorrAccount;
}

export async function getAccountFromEnv(wallet: TestWallet): Promise<AccountManager> {
export async function getAccountFromEnv(wallet: EmbeddedWallet): Promise<AccountManager> {
return await createAccountFromEnv(wallet);
}
4 changes: 2 additions & 2 deletions src/utils/deploy_account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { type Logger, createLogger } from "@aztec/foundation/log";
import { setupWallet } from "./setup_wallet.js";
import { AztecAddress } from "@aztec/aztec.js/addresses";
import { AccountManager } from "@aztec/aztec.js/wallet";
import { TestWallet } from "@aztec/test-wallet/server";
import { EmbeddedWallet } from "@aztec/wallets/embedded";

export async function deploySchnorrAccount(wallet?: TestWallet): Promise<AccountManager> {
export async function deploySchnorrAccount(wallet?: EmbeddedWallet): Promise<AccountManager> {
let logger: Logger;
logger = createLogger('aztec:aztec-starter');
logger.info('👤 Starting Schnorr account deployment...');
Expand Down
Loading