Skip to content

Commit a9f25fa

Browse files
authored
fix(docs): update CLI commands, ABI fields, and tutorial fixes (#22160)
## Summary - Update `aztec new` CLI syntax to remove deprecated `--contract` flag in counter and recursive verification tutorials - Rename `l2BlockNumber` to `checkpointNumber` in Inbox ABI `MessageSent` event (token_bridge tutorial, example_swap, token_bridge example) - Remove unused `@aztec/test-wallet` package from token contract tutorial install commands - Fix import path and `#include_code` macro in recursive verification tutorial - Use approximate proof size (`~500`) instead of hardcoded `508` ## Test plan - [ ] Verify `yarn build` passes in `docs/` - [ ] Spot-check affected tutorial pages render correctly
2 parents 279ed15 + 49e2563 commit a9f25fa

10 files changed

Lines changed: 33 additions & 36 deletions

File tree

docs/developer_versioned_docs/version-v4.2.0-aztecnr-rc.2/docs/tutorials/contract_tutorials/counter_contract.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ This tutorial is compatible with the Aztec version `4.2.0-aztecnr-rc.2`. Install
2222
Run this to create a new contract project:
2323

2424
```bash
25-
aztec new --contract counter
25+
aztec new counter
2626
```
2727

2828
Your structure should look like this:

docs/developer_versioned_docs/version-v4.2.0-aztecnr-rc.2/docs/tutorials/contract_tutorials/recursive_verification.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ For example, consider a machine learning inference that needs 10,000 input featu
4242

4343
1. Perform the computation offchain in a vanilla Noir circuit with no input limits
4444
2. Generate a proof of correct execution
45-
3. Verify only the proof onchain (115 fields for VK + 457-508 fields for proof + N public inputs)
45+
3. Verify only the proof onchain (115 fields for VK + ~500 fields for proof + N public inputs)
4646

4747
This pattern transforms arbitrarily large computations into fixed-size proof verification.
4848

@@ -68,7 +68,7 @@ flowchart LR
6868

6969
Proof verification enables several patterns:
7070

71-
- **Bypassing Input Limits**: Aztec private functions have strict input constraints. A proof verification call uses ~624 fields (115 VK + 508 proof + 1 public input), but can attest to computations with arbitrarily many inputs. For example, proving membership in a set of 10,000 elements becomes a fixed-size verification.
71+
- **Bypassing Input Limits**: Aztec private functions have strict input constraints. A proof verification call uses ~616 fields (115 VK + ~500 proof + 1 public input), but can attest to computations with arbitrarily many inputs. For example, proving membership in a set of 10,000 elements becomes a fixed-size verification.
7272

7373
- **Cross-System Verification**: Verify proofs generated by external Noir circuits within your Aztec application. This enables composability: your contract can trust computations performed by other systems without those systems needing to be Aztec-native.
7474

@@ -225,10 +225,10 @@ The contract demonstrates several important patterns:
225225

226226
### Create the Contract Project
227227

228-
Use `aztec init` to generate the contract project structure:
228+
Use `aztec new` to generate the contract project structure:
229229

230230
```bash
231-
aztec init --contract contract
231+
aztec new contract --name ValueNotEqual
232232
```
233233

234234
This creates:
@@ -541,7 +541,7 @@ Create `scripts/generate_data.ts`:
541541

542542
```typescript title="generate_data" showLineNumbers
543543
import { Noir } from "@aztec/noir-noir_js";
544-
import circuitJson from "../../../../target/hello_circuit.json" with { type: "json" };
544+
import circuitJson from "../circuit/target/hello_circuit.json" with { type: "json" };
545545
import { Barretenberg, UltraHonkBackend, deflattenFields } from "@aztec/bb.js";
546546
import fs from "fs";
547547
import { exit } from "process";
@@ -597,14 +597,14 @@ if (proofAsFields.length === 0) {
597597
const vkAsFields = recursiveArtifacts.vkAsFields;
598598

599599
console.log(`VK size: ${vkAsFields.length}`); // Should be 115
600-
console.log(`Proof size: ${proofAsFields.length}`); // Should be 508
600+
console.log(`Proof size: ${proofAsFields.length}`); // Should be ~500
601601
console.log(`Public inputs: ${mainProofData.publicInputs.length}`); // Should be 1
602602

603603
// Step 9: Save all data to JSON for contract interaction
604604
const data = {
605605
vkAsFields: vkAsFields, // 115 field elements - the verification key
606606
vkHash: recursiveArtifacts.vkHash, // Hash of VK - stored in contract
607-
proofAsFields: proofAsFields, // 508 field elements - the proof
607+
proofAsFields: proofAsFields, // ~500 field elements - the proof
608608
publicInputs: mainProofData.publicInputs.map((p: string) => p.toString()),
609609
};
610610

@@ -659,7 +659,7 @@ Always verify locally before submitting onchain. Onchain verification costs gas/
659659

660660
#### Field Element Conversion
661661

662-
ZK proofs are arrays of bytes, but Aztec contracts work with field elements. We convert the proof and VK to arrays of 115 and 508 field elements respectively.
662+
ZK proofs are arrays of bytes, but Aztec contracts work with field elements. We convert the proof and VK to arrays of 115 and ~500 field elements respectively.
663663

664664
```typescript
665665
let proofAsFields = recursiveArtifacts.proofAsFields;
@@ -701,7 +701,7 @@ Expected output:
701701
Proof verification: SUCCESS
702702
Using deflattenFields to convert proof...
703703
VK size: 115
704-
Proof size: 508
704+
Proof size: 500
705705
Public inputs: 1
706706
Done
707707
```
@@ -714,7 +714,7 @@ The generated `data.json` contains:
714714
{
715715
"vkAsFields": ["0x...", "0x...", ...], // 115 field elements
716716
"vkHash": "0x...", // Single field element
717-
"proofAsFields": ["0x...", "0x...", ...], // 508 field elements
717+
"proofAsFields": ["0x...", "0x...", ...], // ~500 field elements
718718
"publicInputs": ["2"] // The public input y=2
719719
}
720720
```
@@ -832,7 +832,7 @@ async function main() {
832832
const interaction = await valueNotEqual.methods.increment(
833833
accounts[0].item,
834834
data.vkAsFields as unknown as FieldLike[], // 115 field VK
835-
data.proofAsFields as unknown as FieldLike[], // 508 field proof
835+
data.proofAsFields as unknown as FieldLike[], // ~500 field proof
836836
data.publicInputs as unknown as FieldLike[], // Public inputs
837837
);
838838

@@ -885,7 +885,7 @@ This single line triggers a complex flow:
885885

886886
2. **Proof Generation** (client-side, in PXE):
887887
- Generate a ZK proof that the private execution was correct
888-
- This proof doesn't reveal inputs (including the 508-field proof!)
888+
- This proof doesn't reveal inputs (including the ~500-field proof!)
889889

890890
3. **Transaction Submission**:
891891
- Send the proof + encrypted logs + public function calls to the network

docs/developer_versioned_docs/version-v4.2.0-aztecnr-rc.2/docs/tutorials/contract_tutorials/token_contract.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ cd bob_token
4444
yarn init
4545
# This is to ensure yarn uses node_modules instead of pnp for dependency installation
4646
yarn config set nodeLinker node-modules
47-
yarn add @aztec/aztec.js@4.2.0-aztecnr-rc.2 @aztec/accounts@4.2.0-aztecnr-rc.2 @aztec/test-wallet@4.2.0-aztecnr-rc.2 @aztec/kv-store@4.2.0-aztecnr-rc.2
47+
yarn add @aztec/aztec.js@4.2.0-aztecnr-rc.2 @aztec/accounts@4.2.0-aztecnr-rc.2 @aztec/kv-store@4.2.0-aztecnr-rc.2
4848
aztec init
4949
```
5050

5151
## Contract structure
5252

53-
The `aztec init` command created a workspace with two crates: a `bob_token_contract` crate for your smart contract code and a `bob_token_test` crate for Noir tests. In `bob_token_contract/src/main.nr` we even have a proto-contract. Let's replace it with a simple starting point:
53+
The `aztec init` command created a contract project with `Nargo.toml` and `src/main.nr`. Let's replace the boilerplate in `src/main.nr` with a simple starting point:
5454

5555
```rust
5656
use aztec::macros::aztec;

docs/developer_versioned_docs/version-v4.2.0-aztecnr-rc.2/docs/tutorials/js_tutorials/token_bridge.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ const INBOX_ABI = [
830830
type: "event",
831831
name: "MessageSent",
832832
inputs: [
833-
{ name: "l2BlockNumber", type: "uint256", indexed: true },
833+
{ name: "checkpointNumber", type: "uint256", indexed: true },
834834
{ name: "index", type: "uint256", indexed: false },
835835
{ name: "hash", type: "bytes32", indexed: true },
836836
{ name: "rollingHash", type: "bytes16", indexed: false },

docs/docs-developers/docs/tutorials/contract_tutorials/counter_contract.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ Your structure should look like this:
4141
| | |-Nargo.toml <-- test package config
4242
```
4343

44-
The `aztec new` command creates a workspace with two crates: a `counter_contract` crate for your smart contract code and a `counter_test` crate for Noir tests. The file `counter_contract/src/main.nr` will soon turn into our smart contract!
44+
The `aztec new` command creates a contract project with `Nargo.toml` and `src/main.nr`. The file `src/main.nr` will soon turn into our smart contract!
4545

46-
Add the following dependency to `counter_contract/Nargo.toml` under the existing `aztec` dependency:
46+
Add the following dependency to `Nargo.toml` under the existing `aztec` dependency:
4747

4848
```toml
4949
[dependencies]

docs/docs-developers/docs/tutorials/contract_tutorials/recursive_verification.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,13 @@ Use `aztec new` to generate the contract project structure:
211211
aztec new contract --name ValueNotEqual
212212
```
213213

214-
This creates a workspace with two crates:
214+
This creates:
215215

216216
```tree
217217
contract/
218-
├── Nargo.toml # Workspace root
219-
├── contract/
220-
│ ├── src/
221-
│ │ └── main.nr # Contract code
222-
│ └── Nargo.toml # Contract configuration
223-
└── test/
224-
├── src/
225-
│ └── lib.nr # Test code
226-
└── Nargo.toml # Test configuration
218+
├── src/
219+
│ └── main.nr # Contract code
220+
└── Nargo.toml # Contract configuration
227221
```
228222

229223
### Contract Configuration
@@ -460,7 +454,10 @@ The proof generation script executes the circuit offchain and produces the proof
460454

461455
Create `scripts/generate_data.ts`:
462456

463-
#include_code generate_data /docs/examples/ts/recursive_verification/scripts/generate_data.ts typescript
457+
```js
458+
import circuitJson from "../circuit/target/hello_circuit.json" with { type: "json" };
459+
#include_code generate_data /docs/examples/ts/recursive_verification/scripts/generate_data.ts raw
460+
```
464461

465462
### Understanding the Proof Generation Pipeline
466463

docs/docs-developers/docs/tutorials/contract_tutorials/token_contract.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ cd bob_token
4444
yarn init
4545
# This is to ensure yarn uses node_modules instead of pnp for dependency installation
4646
yarn config set nodeLinker node-modules
47-
yarn add @aztec/aztec.js@#include_aztec_version @aztec/accounts@#include_aztec_version @aztec/test-wallet@#include_aztec_version @aztec/kv-store@#include_aztec_version
47+
yarn add @aztec/aztec.js@#include_aztec_version @aztec/accounts@#include_aztec_version @aztec/kv-store@#include_aztec_version
4848
aztec init
4949
```
5050

5151
## Contract structure
5252

53-
The `aztec init` command created a workspace with two crates: a `bob_token_contract` crate for your smart contract code and a `bob_token_test` crate for Noir tests. In `bob_token_contract/src/main.nr` we even have a proto-contract. Let's replace it with a simple starting point:
53+
The `aztec init` command created a contract project with `Nargo.toml` and `src/main.nr`. Let's replace the boilerplate in `src/main.nr` with a simple starting point:
5454

5555
```rust
5656
#include_code start /docs/examples/contracts/bob_token_contract/src/main.nr raw

docs/examples/ts/example_swap/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ const INBOX_ABI = [
260260
type: "event",
261261
name: "MessageSent",
262262
inputs: [
263-
{ name: "l2BlockNumber", type: "uint256", indexed: true },
263+
{ name: "checkpointNumber", type: "uint256", indexed: true },
264264
{ name: "index", type: "uint256", indexed: false },
265265
{ name: "hash", type: "bytes32", indexed: true },
266266
{ name: "rollingHash", type: "bytes16", indexed: false },

docs/examples/ts/recursive_verification/scripts/generate_data.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import circuitJson from "../../../../target/hello_circuit.json" with { type: "json" };
12
// docs:start:generate_data
23
import { Noir } from "@aztec/noir-noir_js";
3-
import circuitJson from "../../../../target/hello_circuit.json" with { type: "json" };
44
import { Barretenberg, UltraHonkBackend, deflattenFields } from "@aztec/bb.js";
55
import fs from "fs";
66
import { exit } from "process";
@@ -56,14 +56,14 @@ if (proofAsFields.length === 0) {
5656
const vkAsFields = recursiveArtifacts.vkAsFields;
5757

5858
console.log(`VK size: ${vkAsFields.length}`); // Should be 115
59-
console.log(`Proof size: ${proofAsFields.length}`); // Should be 508
59+
console.log(`Proof size: ${proofAsFields.length}`); // Should be ~500
6060
console.log(`Public inputs: ${mainProofData.publicInputs.length}`); // Should be 1
6161

6262
// Step 9: Save all data to JSON for contract interaction
6363
const data = {
6464
vkAsFields: vkAsFields, // 115 field elements - the verification key
6565
vkHash: recursiveArtifacts.vkHash, // Hash of VK - stored in contract
66-
proofAsFields: proofAsFields, // 508 field elements - the proof
66+
proofAsFields: proofAsFields, // ~500 field elements - the proof
6767
publicInputs: mainProofData.publicInputs.map((p: string) => p.toString()),
6868
};
6969

docs/examples/ts/token_bridge/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ const INBOX_ABI = [
162162
type: "event",
163163
name: "MessageSent",
164164
inputs: [
165-
{ name: "l2BlockNumber", type: "uint256", indexed: true },
165+
{ name: "checkpointNumber", type: "uint256", indexed: true },
166166
{ name: "index", type: "uint256", indexed: false },
167167
{ name: "hash", type: "bytes32", indexed: true },
168168
{ name: "rollingHash", type: "bytes16", indexed: false },

0 commit comments

Comments
 (0)