Skip to content
Open
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
75 changes: 75 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash

# Pre-commit hook to strip local aztec-packages resolutions from package.json
# and clean up vite.config.ts fs.allow paths
# This prevents accidentally committing local development paths

REPO_ROOT=$(git rev-parse --show-toplevel)

MODIFIED=0

# Check package.json
PACKAGE_FILE="package.json"
FULL_PATH="$REPO_ROOT/$PACKAGE_FILE"

if [ -f "$FULL_PATH" ] && git diff --cached --name-only | grep -q "^$PACKAGE_FILE$"; then
# Check if resolutions field exists with link: entries
if grep -q '"resolutions"' "$FULL_PATH" && grep -q '"link:' "$FULL_PATH"; then
echo "Stripping local resolutions from $PACKAGE_FILE..."

# Use node to remove the resolutions field
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('$FULL_PATH', 'utf-8'));
if (pkg.resolutions) {
delete pkg.resolutions;
fs.writeFileSync('$FULL_PATH', JSON.stringify(pkg, null, 2) + '\n');
}
"

# Re-stage the file
git add "$FULL_PATH"
MODIFIED=1
fi
fi

# Check vite.config.ts for absolute aztec-packages paths
VITE_CONFIG="vite.config.ts"
VITE_PATH="$REPO_ROOT/$VITE_CONFIG"

if [ -f "$VITE_PATH" ] && git diff --cached --name-only | grep -q "^$VITE_CONFIG$"; then
# Check if fs.allow contains absolute paths to aztec-packages
if grep -q "allow:" "$VITE_PATH" && grep -E "'/.*aztec-packages/" "$VITE_PATH" > /dev/null 2>&1; then
echo "Cleaning up vite.config.ts fs.allow paths..."

# Use node to clean up the vite config
node -e "
const fs = require('fs');
let content = fs.readFileSync('$VITE_PATH', 'utf-8');

// Replace fs.allow block with minimal version
const fsBlockRegex = /fs:\s*\{[\s\S]*?allow:\s*\[[\s\S]*?\],[\s\S]*?\},/;
const minimalFsAllowBlock = \`fs: {
allow: [searchForWorkspaceRoot(process.cwd())],
},\`;

if (fsBlockRegex.test(content)) {
content = content.replace(fsBlockRegex, minimalFsAllowBlock);
fs.writeFileSync('$VITE_PATH', content);
}
"

# Re-stage the file
git add "$VITE_PATH"
MODIFIED=1
fi
fi

if [ $MODIFIED -eq 1 ]; then
echo ""
echo "Local development paths have been stripped."
echo "The commit will proceed with the cleaned files."
echo ""
fi

exit 0
13 changes: 8 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
env:
PASSWORD: ${{ secrets.PASSWORD }}

permissions:
contents: read
pull-requests: write

jobs:
build-and-deploy:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -42,8 +46,6 @@ jobs:
- name: Set Aztec version
run: |
aztec-up ${{ vars.VERSION }}
docker pull aztecprotocol/aztec:${{ vars.VERSION }}
docker tag aztecprotocol/aztec:${{ vars.VERSION }} aztecprotocol/aztec:latest

- name: Compile contracts
run: yarn compile:contracts
Expand All @@ -55,9 +57,10 @@ jobs:
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy to Vercel
run: |
vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} --archive=tgz --yes
id: deploy
run: |
DEPLOY_URL=$(vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} --archive=tgz --yes)
echo "url=$DEPLOY_URL" >> $GITHUB_OUTPUT

- name: Comment deployment URL on PR
if: github.event_name == 'pull_request'
Expand All @@ -68,5 +71,5 @@ jobs:
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🚀 Deployed to Vercel!\n\nContracts deployed to devnet and website published.'
body: '🚀 Deployed to Vercel!\n\n**Preview URL:** ${{ steps.deploy.outputs.url }}'
})
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ curl -s https://install.aztec.network | bash

### 3. Set Aztec Version

The project uses Aztec version `v3.0.0-nightly.20251120`. Set it using:
The project uses Aztec version `v3.0.0-devnet.20251212`. Set it using:

```bash
aztec-up 3.0.0-nightly.20251120
docker tag aztecprotocol/aztec:3.0.0-nightly.20251120 aztecprotocol/aztec:latest # Temporary workaround for aztec-nargo issues
aztec-up 3.0.0-devnet.20251212
```

## Development Setup
Expand All @@ -49,7 +48,7 @@ docker tag aztecprotocol/aztec:3.0.0-nightly.20251120 aztecprotocol/aztec:latest
In a separate terminal, start the local Aztec sandbox:

```bash
aztec start --sandbox
aztec start --local-network
```

This will start a local Aztec node on `http://localhost:8080`.
Expand Down
6 changes: 3 additions & 3 deletions contracts/proof_of_password/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type = "contract"
authors = [""]

[dependencies]
aztec = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v3.0.0-nightly.20251120", directory = "noir-projects/aztec-nr/aztec" }
token = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v3.0.0-nightly.20251120", directory = "noir-projects/noir-contracts/contracts/app/token_contract" }
aztec = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v3.0.0-devnet.20251212", directory = "noir-projects/aztec-nr/aztec" }
token = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v3.0.0-devnet.20251212", directory = "noir-projects/noir-contracts/contracts/app/token_contract" }
poseidon = { tag = "v0.1.1", git = "https://github.com/noir-lang/poseidon" }
compressed_string = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v3.0.0-nightly.20251120", directory = "noir-projects/aztec-nr/compressed-string" }
compressed_string = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v3.0.0-devnet.20251212", directory = "noir-projects/aztec-nr/compressed-string" }
8 changes: 4 additions & 4 deletions contracts/proof_of_password/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@ pub contract ProofOfPassword {
);

// Safety: PXE will enforce a sender for the tags of the notes created
// in the Token.mint function, but this one intented to be called by anyone
// that knows the passord, not necessarily the recipient. Chances are this fn
// in the Token.mint function, but this particular function is intended to be called by anyone
// that knows the password, not necessarily the recipient. In particular, chances are this fn
// will be invoked by the MultiCallEntrypoint protocol contract,
// which does not set a sender for tags.
// We intend the "to" of this function to claim the notes, so we're just calling
// the oracle for its sideeffects, making it safe to call
// the oracle for its side effects, therefore making it safe to call
unsafe {
set_sender_for_tags(to);
}

let address = self.storage.grego_coin_address.read();
self.call(Token::at(address).mint_to_private(to, 1000));

// Derive nullifier from sender and password. This is still a privacy leak, since
// Derive nullifier from sender and password. This is a privacy leak, since
// knowing the password and an address is sufficient to know if someone has used this
// contract or not. But at least, they need the password
let nullifier = poseidon2_hash([to.to_field(), field_compressed_str.serialize()[0]]);
Expand Down
2 changes: 1 addition & 1 deletion contracts/proof_of_password/src/test/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ unconstrained fn fails_on_incorrect_password() {
);
}

#[test(should_fail_with = "Contract execution has reverted: Error encountered when inserting revertible nullifiers from private")]
#[test(should_fail_with = "Contract execution has reverted: Attempted to emit duplicate siloed nullifier")]
unconstrained fn fails_on_double_dip() {
let (env, pop_contract_address, _, recipient) = setup();

Expand Down
26 changes: 15 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,28 @@
"serve": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"copy:dependencies": "cd contracts && aztec check && WORKDIR=$(pwd) && cd $HOME/nargo/github.com/AztecProtocol/aztec-packages/v3.0.0-nightly.20251120/noir-projects/noir-contracts && aztec compile --package token_contract && mkdir -p $WORKDIR/target && cp $HOME/nargo/github.com/AztecProtocol/aztec-packages/v3.0.0-nightly.20251120/noir-projects/noir-contracts/target/token_contract-Token.json $WORKDIR/target/token_contract-Token.json",
"copy:dependencies": "cd contracts && aztec check && WORKDIR=$(pwd) && cd $HOME/nargo/github.com/AztecProtocol/aztec-packages/v3.0.0-devnet.20251212/noir-projects/noir-contracts && aztec compile --package token_contract && mkdir -p $WORKDIR/target && cp $HOME/nargo/github.com/AztecProtocol/aztec-packages/v3.0.0-devnet.20251212/noir-projects/noir-contracts/target/token_contract-Token.json $WORKDIR/target/token_contract-Token.json",
"compile:contracts": "cd contracts && aztec compile --package proof_of_password && aztec codegen ./target/proof_of_password-ProofOfPassword.json",
"test": "cd contracts && aztec test",
"preview": "vite preview",
"deploy:local": "node --experimental-transform-types scripts/deploy.ts --network local",
"deploy:devnet": "node --experimental-transform-types scripts/deploy.ts --network devnet",
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src"
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
"local-aztec:enable": "node scripts/toggle-local-aztec.js enable",
"local-aztec:disable": "node scripts/toggle-local-aztec.js disable",
"local-aztec:status": "node scripts/toggle-local-aztec.js status"
},
"dependencies": {
"@aztec/accounts": "v3.0.0-nightly.20251120",
"@aztec/aztec.js": "v3.0.0-nightly.20251120",
"@aztec/constants": "v3.0.0-nightly.20251120",
"@aztec/entrypoints": "v3.0.0-nightly.20251120",
"@aztec/foundation": "v3.0.0-nightly.20251120",
"@aztec/noir-contracts.js": "v3.0.0-nightly.20251120",
"@aztec/pxe": "v3.0.0-nightly.20251120",
"@aztec/stdlib": "v3.0.0-nightly.20251120",
"@aztec/accounts": "v3.0.0-devnet.20251212",
"@aztec/aztec.js": "v3.0.0-devnet.20251212",
"@aztec/constants": "v3.0.0-devnet.20251212",
"@aztec/entrypoints": "v3.0.0-devnet.20251212",
"@aztec/foundation": "v3.0.0-devnet.20251212",
"@aztec/noir-contracts.js": "v3.0.0-devnet.20251212",
"@aztec/pxe": "v3.0.0-devnet.20251212",
"@aztec/stdlib": "v3.0.0-devnet.20251212",
"@aztec/wallet-sdk": "v3.0.0-devnet.20251212",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mui/icons-material": "^6.3.1",
Expand All @@ -39,7 +43,7 @@
"zod": "^3.23.8"
},
"devDependencies": {
"@aztec/test-wallet": "v3.0.0-nightly.20251120",
"@aztec/test-wallet": "v3.0.0-devnet.20251212",
"@eslint/js": "^9.18.0",
"@playwright/test": "1.49.0",
"@types/buffer-json": "^2",
Expand Down
11 changes: 8 additions & 3 deletions scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import { deriveSigningKey } from '@aztec/stdlib/keys';
import { AztecAddress } from '@aztec/stdlib/aztec-address';
import { createAztecNodeClient, type AztecNode } from '@aztec/aztec.js/node';
import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
import { Fr } from '@aztec/foundation/fields';
import { Fr } from '@aztec/foundation/curves/bn254';
import type { DeployAccountOptions } from '@aztec/aztec.js/wallet';
import { SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';

import { ProofOfPasswordContract } from '../contracts/target/ProofOfPassword.ts';
import { createLogger } from '@aztec/foundation/log';

// Parse network from CLI args (--network <name>)
function getNetworkFromArgs(): string {
Expand All @@ -38,7 +39,7 @@ const NETWORK = getNetworkFromArgs();
// Network-specific node URLs (hardcoded, not configurable)
const NETWORK_URLS: Record<string, string> = {
local: 'http://localhost:8080',
devnet: 'https://devnet.aztec-labs.com',
devnet: 'https://next.devnet.aztec-labs.com',
};

const AZTEC_NODE_URL = NETWORK_URLS[NETWORK];
Expand All @@ -61,7 +62,11 @@ async function setupWallet(aztecNode: AztecNode) {
config.dataDirectory = PXE_STORE_DIR;
config.proverEnabled = PROVER_ENABLED;

return await TestWallet.create(aztecNode, config);
return await TestWallet.create(aztecNode, config, {
proverOrOptions: {
logger: createLogger('bb:native'),
},
});
}

async function getSponsoredPFCContract() {
Expand Down
Loading
Loading