Skip to content

Commit 20899ce

Browse files
authored
fix(docs): backport #22160 — update CLI commands, ABI fields, and tutorial fixes (#22165)
## Summary Backport of #22160 to v4-next. Cherry-pick had conflicts because the `version-v4.2.0-aztecnr-rc.2` versioned docs and `example_swap` don't exist on v4-next (deleted). Those changes were dropped. A content conflict in `counter_contract.md` was resolved by taking the incoming (PR) version. ### Changes applied: - Update `aztec new` CLI description in counter contract tutorial - Remove unused `@aztec/test-wallet` from token contract tutorial - Fix `#include_code` macro and import path in recursive verification tutorial - Update proof size comments from hardcoded `508` to `~500` - Rename `l2BlockNumber` → `checkpointNumber` in token_bridge ABI ClaudeBox log: https://claudebox.work/s/99e763f53ec8891b?run=1
2 parents d79af8a + 1e2e745 commit 20899ce

5 files changed

Lines changed: 12 additions & 9 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ Your structure should look like this:
3535
| |-Nargo.toml
3636
```
3737

38-
The file `main.nr` will soon turn into our smart contract!
38+
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!
3939

40-
Add the following dependencies to `Nargo.toml` under the autogenerated content:
40+
Add the following dependency to `Nargo.toml` under the existing `aztec` dependency:
4141

4242
```toml
4343
[dependencies]

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,10 @@ The proof generation script executes the circuit offchain and produces the proof
454454

455455
Create `scripts/generate_data.ts`:
456456

457-
#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+
```
458461

459462
### Understanding the Proof Generation Pipeline
460463

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/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)