Skip to content

Commit 3ce4dd1

Browse files
authored
Merge pull request #249 from AztecProtocol/josh/add-update-version-skill
Add /update-version slash command for Claude Code
2 parents b8ef343 + 5c7f597 commit 3ce4dd1

File tree

1 file changed

+210
-0
lines changed

1 file changed

+210
-0
lines changed

.claude/commands/update-version.md

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
---
2+
description: Update the Aztec version across the entire repo, update contract and TS code, and run tests. Usage: /update-version <new-version-tag>
3+
---
4+
5+
# Update Aztec Version
6+
7+
Update all Aztec version references, sync the MCP server, update contract and TypeScript code for API changes, and run tests.
8+
9+
**Version argument:** $ARGUMENTS
10+
11+
## Workflow
12+
13+
### Step 1: Determine the new version
14+
15+
- If a version argument is provided, use it directly (strip leading `v` if present for npm versions, keep `v` prefix for git tags)
16+
- If no version argument, ask the user to provide one
17+
18+
The version has two forms:
19+
- **npm version** (no `v` prefix): e.g. `4.1.0-devnet.1` — used in `package.json`, config JSONs, README install command, and `CLAUDE.md`
20+
- **git tag** (with `v` prefix): e.g. `v4.1.0-devnet.1` — used in `Nargo.toml` aztec dependency tag and for MCP sync
21+
22+
### Step 2: Sync MCP server to new version
23+
24+
Call `aztec_sync_repos` with the new version tag (with `v` prefix) and `force: true`:
25+
26+
```
27+
aztec_sync_repos({ version: "v<version>", force: true })
28+
```
29+
30+
Then call `aztec_status()` to verify the sync succeeded. This gives the MCP server access to the new version's source code and docs — essential for the later steps.
31+
32+
### Step 3: Read current files
33+
34+
Read these files to understand current state:
35+
- `Nargo.toml`
36+
- `package.json`
37+
- `config/local-network.json`
38+
- `config/devnet.json`
39+
- `README.md`
40+
- `CLAUDE.md`
41+
42+
### Step 4: Update all version references
43+
44+
Use the Edit tool to update each file. Be precise — only change version strings, nothing else.
45+
46+
**1. `Nargo.toml`** — Update the aztec dependency tag:
47+
```toml
48+
aztec = { git = "https://github.com/AztecProtocol/aztec-nr/", tag = "v<VERSION>", directory = "aztec" }
49+
```
50+
51+
**2. `package.json`** — Update ALL `@aztec/*` dependency versions to the new npm version (no `v` prefix). Do NOT change non-aztec dependencies.
52+
53+
**3. `config/local-network.json`** — Update `settings.version` to the new npm version.
54+
55+
**4. `config/devnet.json`** — Update `settings.version` to the new npm version.
56+
57+
**5. `README.md`** — Update the install command version in the Getting Started section:
58+
```bash
59+
export VERSION=<NEW_VERSION>
60+
curl -fsSL "https://install.aztec.network/${VERSION}" | VERSION="${VERSION}" bash -s
61+
```
62+
63+
**6. `CLAUDE.md`** — Update the `**Aztec version: ...**` line to reflect the new version.
64+
65+
### Step 5: Verify version references
66+
67+
After all edits, grep the repo for the OLD version string to check for any missed references:
68+
69+
```bash
70+
grep -r "<OLD_VERSION>" --include="*.toml" --include="*.json" --include="*.md" .
71+
```
72+
73+
Report any remaining occurrences (excluding `node_modules`, `target`, `.git`).
74+
75+
### Step 6: Upgrade the Aztec CLI
76+
77+
Run `aztec-up install <VERSION>` (npm version, no `v` prefix) to upgrade the local aztec toolchain (CLI, nargo, bb, etc.) to match the new version:
78+
79+
```bash
80+
aztec-up install <VERSION>
81+
```
82+
83+
Verify with `aztec --version`.
84+
85+
### Step 6b: Install dependencies
86+
87+
Run `yarn install` to pull new `@aztec/*` package versions and update `yarn.lock`.
88+
89+
### Step 7: Research API changes in the new version
90+
91+
Use the MCP tools (now synced to the new version) to research what changed. This is critical — the Aztec API frequently changes between versions.
92+
93+
**7a. Search for breaking changes in Noir contract APIs:**
94+
95+
Use `aztec_search_code` to look up current signatures and patterns for:
96+
- Contract macros: `#[aztec]`, `#[storage]`, `#[note]`, `#[external]`, `#[initializer]`, `#[only_self]`
97+
- Storage types: `Map`, `Owned`, `PrivateSet`, `PublicMutable`
98+
- Note system: `NoteGetterOptions`, note delivery via `MessageDelivery`
99+
- Test environment: `TestEnvironment`, `derive_storage_slot_in_map`
100+
- Oracle functions: `debug_log_format`
101+
- Core traits: `Serialize`, `Deserialize`, `Packable`, `ToField`
102+
103+
**7b. Search for breaking changes in TypeScript APIs:**
104+
105+
Use `aztec_search_code` and `aztec_search_docs` to look up current patterns for:
106+
- Wallet setup: `EmbeddedWallet`, `createAztecNodeClient`
107+
- Account management: `AccountManager`, `GrumpkinScalar`, Schnorr accounts
108+
- Fee payment: `SponsoredFeePaymentMethod`, `SponsoredFPCContract`
109+
- Contract interaction: `.simulate()`, `.send()`, `ContractDeployer`
110+
- Protocol contracts: `getCanonicalFeeJuice`, `SPONSORED_FPC_SALT`
111+
- Types: `Fr`, `AztecAddress`, `TxStatus`, `GasSettings`
112+
113+
### Step 8: Update Noir contract files
114+
115+
Based on the API research from Step 7, update the contract source files as needed. Read each file first, then apply changes.
116+
117+
**Files to check and update:**
118+
- `src/main.nr` — Main contract (imports, macros, storage declarations, function signatures, note handling, message delivery)
119+
- `src/race.nr` — Race struct (trait implementations, serialization)
120+
- `src/game_round_note.nr` — GameRoundNote (note macro, trait implementations)
121+
- `src/test/utils.nr` — Test setup helper (TestEnvironment API)
122+
- `src/test/helpers.nr` — Test helpers (TestEnvironment API)
123+
- `src/test/pod_racing.nr` — TXE unit tests (test API, storage slot derivation)
124+
125+
**Common breaking changes to watch for:**
126+
- Import path changes (e.g. `aztec::protocol::address` vs `aztec::address`)
127+
- Macro attribute changes or new required attributes
128+
- Storage type API changes (constructor, read/write methods)
129+
- Note trait requirements or macro changes
130+
- TestEnvironment method signature changes
131+
- Trait rename/restructure (Packable, Serialize, etc.)
132+
133+
### Step 9: Compile the contract
134+
135+
Run `yarn compile` to compile the Noir contract with the new Aztec version.
136+
137+
If compilation fails, read the error messages carefully and fix the contract code. Use `aztec_search_code` and `aztec_search_docs` to look up correct patterns for the new version. Iterate until compilation succeeds.
138+
139+
Then run `yarn codegen` to regenerate the TypeScript artifacts from the compiled contract.
140+
141+
### Step 10: Update TypeScript files
142+
143+
Based on the API research from Step 7 and any changes revealed by `yarn codegen`, update TypeScript files as needed.
144+
145+
**Utility files (update first — other files depend on these):**
146+
- `src/utils/setup_wallet.ts` — Wallet creation, PXE setup
147+
- `src/utils/create_account_from_env.ts` — Account creation from env vars
148+
- `src/utils/deploy_account.ts` — Account deployment with fees
149+
- `src/utils/sponsored_fpc.ts` — SponsoredFPC setup
150+
- `config/config.ts` — Config manager
151+
152+
**E2E test files:**
153+
- `src/test/e2e/index.test.ts` — Full game lifecycle tests
154+
- `src/test/e2e/accounts.test.ts` — Account tests
155+
- `src/test/e2e/public_logging.test.ts` — Logging tests
156+
157+
**Script files:**
158+
- `scripts/deploy_contract.ts` — Contract deployment
159+
- `scripts/deploy_account.ts` — Account deployment
160+
- `scripts/multiple_wallet.ts` — Multi-wallet interaction
161+
- `scripts/interaction_existing_contract.ts` — Existing contract interaction
162+
- `scripts/profile_deploy.ts` — Transaction profiling
163+
- `scripts/fees.ts` — Fee payment examples
164+
- `scripts/read_debug_logs.ts` — Debug log reading
165+
- `scripts/get_block.ts` — Block retrieval
166+
167+
**Common TypeScript breaking changes:**
168+
- Import path changes (submodule paths like `@aztec/aztec.js/fee` may restructure)
169+
- Constructor/factory method signature changes
170+
- New required parameters on `.simulate()` or `.send()`
171+
- Type renames or moved exports
172+
- Fee payment API changes
173+
174+
### Step 11: Run Noir TXE tests
175+
176+
Run `yarn test:nr` to execute the Noir unit tests in the TXE simulator (no network needed).
177+
178+
If tests fail, diagnose and fix the contract test code. Iterate until tests pass.
179+
180+
### Step 12: Run TypeScript E2E tests against local network
181+
182+
**Prerequisites:** The local network must already be running (`aztec start --local-network`). If it's not running, tell the user to start it and wait for confirmation before proceeding.
183+
184+
1. Clear stale PXE state: `rm -rf ./store`
185+
2. Run E2E tests: `yarn test:js`
186+
187+
If tests fail:
188+
- Read the error output carefully
189+
- Fix the relevant TypeScript test or utility files
190+
- Use `aztec_search_code` or `aztec_search_docs` to look up correct API usage for the new version
191+
- Re-run `yarn test:js` until tests pass
192+
193+
### Step 13: Rebuild ONBOARDING.md
194+
195+
If any source files with `docs:start`/`docs:end` markers were modified, rebuild the onboarding docs:
196+
197+
```bash
198+
yarn docs:build
199+
```
200+
201+
Marker files: `src/main.nr`, `src/race.nr`, `src/game_round_note.nr`, `src/test/utils.nr`, `src/test/helpers.nr`, `src/test/pod_racing.nr`, `src/utils/sponsored_fpc.ts`
202+
203+
### Step 14: Final summary
204+
205+
Report:
206+
- Old version → new version
207+
- All files modified (version refs, contract code, TypeScript code)
208+
- Test results (TXE and E2E)
209+
- Any remaining issues or manual steps needed
210+
- Remind user to verify devnet compatibility separately if needed (`yarn test::devnet`)

0 commit comments

Comments
 (0)