Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3fa65be
all scripts work
critesjosh Apr 4, 2025
9ce8090
update ci
critesjosh Apr 4, 2025
cdbf1a2
pxe step
critesjosh Apr 4, 2025
7b405de
start pxe later
critesjosh Apr 4, 2025
1afd8db
enable tests again
critesjosh Apr 4, 2025
8c4d027
fix name
critesjosh Apr 4, 2025
38cbe27
Merge branch 'main' into jc/lone-pxe
critesjosh Apr 4, 2025
cbd387a
update fees
critesjosh Apr 4, 2025
7c643b6
fees working on devnet
critesjosh Apr 5, 2025
6841363
update fees to work with different L1s
critesjosh Apr 7, 2025
ab81fdf
update for testnet
critesjosh Apr 7, 2025
ad931fd
omit testing on testnet
critesjosh Apr 7, 2025
a9cc97a
rename setup
critesjosh Apr 16, 2025
303cf7a
update to 85.0-alpha-testnet.1
critesjosh Apr 16, 2025
addfa90
cleanup
critesjosh Apr 16, 2025
ce8328b
wait for txs
critesjosh Apr 25, 2025
3d228cc
add explorer link
critesjosh Apr 25, 2025
de46c59
update to alpha-testnet.2
critesjosh Apr 26, 2025
1fb796b
add testnet note
critesjosh Apr 26, 2025
f116785
update to alpha-testnet.3
critesjosh Apr 28, 2025
9bc6933
Merge branch 'testnet' of https://github.com/AztecProtocol/aztec-star…
critesjosh Apr 28, 2025
2b04ce4
await
critesjosh Apr 28, 2025
3320d1f
fix js tests
critesjosh Apr 29, 2025
2a21c20
Update .env
critesjosh May 8, 2025
0ad29d6
Update README.md
critesjosh May 8, 2025
187a6aa
update config
critesjosh May 15, 2025
784106b
updates
critesjosh May 15, 2025
3b40182
Merge branch 'testnet' of https://github.com/AztecProtocol/aztec-star…
critesjosh May 15, 2025
5d1bd54
update to 87.2, add timeouts
critesjosh May 24, 2025
d234b45
update to 87.3
critesjosh May 28, 2025
28b8a0e
update to 87.4
critesjosh May 29, 2025
38fbd89
Create testnet_scripts.yaml
critesjosh May 29, 2025
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 @@ -2,7 +2,7 @@ FROM --platform=linux/amd64 node:lts-bookworm-slim
SHELL ["/bin/bash", "-c"]

ENV NVM_DIR=/root/.nvm
ENV NODE_VERSION=18.19.0
ENV NODE_VERSION=22.15.0

RUN apt update && apt install -y curl bash git tar gzip libc++-dev jq python3 build-essential

Expand Down
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
L1_URL=https://ethereum-sepolia-rpc.publicnode.com
NODE_URL="https://aztec-alpha-testnet-fullnode.zkv.xyz" # testnet

L1_CHAIN_ID="11155111" # Sepolia
5 changes: 5 additions & 0 deletions .env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
L1_URL=https://ethereum-sepolia-rpc.publicnode.com
BOOTNODE="http://34.107.66.170/" # testnet

# L1_CHAIN_ID="1337" # Devent
L1_CHAIN_ID="11155111" # Sepolia
2 changes: 1 addition & 1 deletion .github/scripts/update_contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ echo "version tag: $version_tag"
nargo_file_path="$copy_to_file_path/Nargo.toml"

repo_url="https://github.com/AztecProtocol/aztec-packages.git"
contracts_path="noir-projects/noir-contracts/contracts"
contracts_path="noir-projects/noir-contracts/contracts/app"

# Check if the file exists
if [ ! -f "$nargo_file_path" ]; then
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/testnet_scripts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
on:
push:
branches:
- testnet
pull_request:
branches:
- testnet

jobs:
setup-and-run:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '22'
cache: 'yarn' # Optional: cache dependencies for faster builds

- name: Set up Docker
uses: docker/setup-buildx-action@v2

- name: Install Aztec CLI
run: |
curl -s https://install.aztec.network > tmp.sh
bash tmp.sh <<< yes "yes"

- name: Update path
run: echo "/home/runner/.aztec/bin" >> $GITHUB_PATH

- name: Set Aztec version and start sandbox
run: |
VERSION=0.87.4 aztec-up
aztec start --sandbox &

- name: Install project dependencies
run: yarn

- name: Compile, generate code, and run tests
run: script -e -c "${AZTEC_NARGO:-aztec-nargo} compile"

- name: Codegen
run: script -e -c "aztec codegen target --outdir src/artifacts"

- name: Run scripts
run: script -e -c "yarn deploy && yarn deploy-account && yarn fees && yarn multiple-pxe"
11 changes: 6 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:

- name: Set Aztec version and start sandbox
run: |
VERSION=0.84.0 aztec-up
aztec start --sandbox &
VERSION=0.84.0-alpha-testnet.1 aztec-up
aztec start --sandbox --no-pxe &

- name: Install project dependencies
run: yarn

- name: Compile, generate code, and run tests
- name: Compile
run: script -e -c "${AZTEC_NARGO:-aztec-nargo} compile"

- name: Codegen
Expand All @@ -43,8 +43,9 @@ jobs:
- name: Change ownership # to get around Docker issues
run: sudo chown -R $(whoami) ~/nargo && sudo chown -R $(whoami) ~/nargo/github.com

- name: Run tests
run: script -e -c "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --config jest.integration.config.json && aztec test"
- name: Start PXE
run: |
aztec start --port 8081 --pxe --pxe.nodeUrl=http://localhost:8080/ --pxe.proverEnabled false &

- name: Run scripts
run: script -e -c "yarn deploy && yarn deploy-account && yarn fees"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ log/
.vscode
.DS_Store
codegenCache.json
store/*
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-packages/", tag = "v0.84.0", directory = "noir-projects/aztec-nr/aztec" }
aztec = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v0.87.4", directory = "noir-projects/aztec-nr/aztec" }
38 changes: 13 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Aztec Starter

This repo is meant to be a starting point for writing Aztec contracts and tests.
This repo is meant to be a starting point for writing Aztec contracts and tests, specifically on the Aztec testnet.

You can find the **Easy Private Voting contract** in `./src/main.nr`. A simple integration test is in `./src/test/index.test.ts`.

Expand All @@ -28,7 +28,7 @@ The corresponding tutorial can be found in the [Aztec docs here](https://docs.az

## 🚀 **Getting Started**

Use **Node.js version 18.19.0**.
Use **Node.js version 22.15.0**.

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

Expand All @@ -41,24 +41,13 @@ bash -i <(curl -s https://install.aztec.network)
Install the correct version of the toolkit with:

```bash
aztec-up 0.84.0
```

Start the sandbox with:

```bash
aztec start --sandbox
aztec-up 0.87.4
```

---

## 📦 **Install Packages**

We need to ignore node version warnings (a temporary fix):

```bash
YARN_IGNORE_ENGINES=true yarn install
```

---

Expand Down Expand Up @@ -86,23 +75,22 @@ yarn codegen

---

## 🧪 **Test**
: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 sandbox, you will need to delete the `./store` directory to avoid errors.

**Make sure the sandbox is running before running tests.**
## 🧪 **Test**

```bash
aztec start --sandbox
```
You don't want to run tests against testnet. This will take a long time. Run tests against the sandbox, as described on the [main branch](https://github.com/AztecProtocol/aztec-starter).

Then test with:
---

```bash
yarn test
```
## Scripts

Testing will run the **TypeScript tests** defined in `index.test.ts` inside `./src/test`, 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;`).
You can find a handful of scripts in the `./scripts` folder.

Note: The Typescript tests spawn an instance of the sandbox to test against, and close it once the TS tests are complete.
- `./scripts/deploy-accounts.ts` is an example of how to deploy a schnorr account.
- `./scripts/deploy.ts` is an example of how to deploy a contract.
- `./scripts/fees.ts` is an example of how to pay for a contract deployment using various fee payment methods.
- `./scripts/multiple_pxe.ts` is an example of how to deploy a contract from one PXE instance and interact with it from another.

---

Expand Down
26 changes: 16 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,29 @@
"scripts": {
"fees": "node --loader ts-node/esm scripts/fees.ts",
"clean": "rm -rf ./src/artifacts ./target",
"clear-store": "rm -rf ./store",
"codegen": "aztec codegen target --outdir src/artifacts",
"compile": "${AZTEC_NARGO:-aztec-nargo} compile",
"deploy": "node --loader ts-node/esm scripts/deploy-contract.ts",
"deploy-account": "node --loader ts-node/esm scripts/deploy-account.ts",
"get-block": "node --loader ts-node/esm scripts/getBlock.ts",
"deploy": "node --loader ts-node/esm scripts/deploy_contract.ts",
"deploy-account": "node --loader ts-node/esm scripts/deploy_account.ts",
"get-block": "node --loader ts-node/esm scripts/get_block.ts",
"multiple-pxe": "node --loader ts-node/esm scripts/multiple_pxe.ts",
"test": "yarn test:js && yarn test:nr",
"test:js": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --config jest.integration.config.json",
"test:js": " rm -rf store/pxe && NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --config jest.integration.config.json",
"test:nr": "aztec test",
"update": "aztec update --contract . && ./.github/scripts/update_contract.sh $(grep -oP 'tag\\s*=\\s*\"\\K[^\"]+' \"Nargo.toml\" | head -1) && yarn && yarn update-readme-version",
"update": "./.github/scripts/update_contract.sh $(grep -oP 'tag\\s*=\\s*\"\\K[^\"]+' \"Nargo.toml\" | head -1) && yarn && yarn update-readme-version",
"update-readme-version": "node ./.github/scripts/update-readme-version.js"
},
"dependencies": {
"@aztec/accounts": "0.84.0",
"@aztec/aztec.js": "0.84.0",
"@aztec/noir-contracts.js": "0.84.0",
"@aztec/stdlib": "0.84.0",
"@types/node": "^22.5.1"
"@aztec/accounts": "0.87.4",
"@aztec/aztec.js": "0.87.4",
"@aztec/noir-contracts.js": "0.87.4",
"@aztec/protocol-contracts": "0.87.4",
"@aztec/pxe": "0.87.4",
"@aztec/stdlib": "0.87.4",
"@types/dotenv": "^8.2.3",
"@types/node": "^22.5.1",
"dotenv": "^16.4.7"
},
"devDependencies": {
"@types/jest": "^29.5.11",
Expand Down
39 changes: 0 additions & 39 deletions scripts/deploy-account.ts

This file was deleted.

28 changes: 0 additions & 28 deletions scripts/deploy-contract.ts

This file was deleted.

12 changes: 12 additions & 0 deletions scripts/deploy_account.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { createLogger, Logger } from "@aztec/aztec.js";
import { setupPXE } from "../src/utils/setup_pxe.js";
import { deploySchnorrAccount } from "../src/utils/deploy_account.js";

export async function deployAccount() {
let logger: Logger;
logger = createLogger('aztec:aztec-starter');
const pxe = await setupPXE()
await deploySchnorrAccount(pxe);
}

deployAccount();
30 changes: 30 additions & 0 deletions scripts/deploy_contract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { EasyPrivateVotingContract } from "../src/artifacts/EasyPrivateVoting.js"
import { createLogger, PXE, Logger, SponsoredFeePaymentMethod, Fr } from "@aztec/aztec.js";
import { TokenContract } from "@aztec/noir-contracts.js/Token"
import { setupPXE } from "../src/utils/setup_pxe.js";
import { getSponsoredFPCInstance } from "../src/utils/sponsored_fpc.js";
import { SponsoredFPCContract } from "@aztec/noir-contracts.js/SponsoredFPC";
import { deploySchnorrAccount } from "../src/utils/deploy_account.js";

async function main() {

let pxe: PXE;
let logger: Logger;

logger = createLogger('aztec:aztec-starter');

pxe = await setupPXE();

const sponsoredFPC = await getSponsoredFPCInstance();
await pxe.registerContract({ instance: sponsoredFPC, artifact: SponsoredFPCContract.artifact });
const sponsoredPaymentMethod = new SponsoredFeePaymentMethod(sponsoredFPC.address);

let accountManager = await deploySchnorrAccount(pxe);
const wallet = await accountManager.getWallet();
const address = await accountManager.getAddress();

const votingContract = await EasyPrivateVotingContract.deploy(wallet, address).send({ fee: { paymentMethod: sponsoredPaymentMethod } }).deployed({timeout: 120000});
logger.info(`Voting Contract deployed at: ${votingContract.address}`);
}

main();
Loading
Loading