This repository contains TypeScript scripts and Noir contracts for the Aztec network. Follow these guidelines when contributing:
- Use Node.js v22 with Yarn.
- Install dependencies with
yarn install. - The Aztec CLI (
aztec) must be installed at the version matchingNargo.tomlandpackage.json. - Start the Aztec local network with
aztec start --local-networkbefore running E2E tests or scripts. This is not needed for compilation or Noir unit tests. - After restarting the local network, always run
rm -rf ./storeto clear stale PXE data.
- This is an ESM project (
"type": "module"inpackage.json). - Compile contracts with
yarn compileand generate TypeScript artifacts withyarn codegen. - Use four spaces for indentation in TypeScript and scripts.
- Do not commit generated artifacts (
src/artifacts,target, orstorefolders). - Never edit
src/artifacts/PodRacing.tsdirectly; it is generated byyarn codegen. - To target devnet instead of local network, set
AZTEC_ENV=devnet(e.g.AZTEC_ENV=devnet yarn deploy).
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 testruns both. Ensure tests pass before committing.
Always call .simulate() before .send() for every state-changing transaction. Simulation runs the transaction locally and surfaces revert reasons immediately instead of waiting for the send timeout with an opaque error.
// Simulate first
await contract.methods.create_game(gameId).simulate({ from: address });
// Then send
await contract.methods.create_game(gameId).send({
from: address,
fee: { paymentMethod },
wait: { timeout }
});For deployments, store the deploy request to reuse it:
const deployRequest = MyContract.deploy(wallet, ...args);
await deployRequest.simulate({ from: address });
const contract = await deployRequest.send({ ... });- Use clear commit messages and provide a concise description in the PR body about the change.
- Mention which tests were executed.