Skip to content

Commit 9ea8692

Browse files
committed
fixes
1 parent 032c644 commit 9ea8692

File tree

9 files changed

+594
-49
lines changed

9 files changed

+594
-49
lines changed

.github/workflows/recursive-verification-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
env:
2020
AZTEC_ENV: sandbox
21-
AZTEC_VERSION: 3.0.0-nightly.20251024
21+
AZTEC_VERSION: 3.0.0-nightly.20251026
2222

2323
steps:
2424
- name: Checkout repository

recursive_verification/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ node_modules
22
**/target/
33
**/codegenCache.json
44
**/artifacts/
5-
store/
5+
store/
6+
pxe/
7+
barretenberg-debug.*
8+
recursive_verification/pxe

recursive_verification/bun.lockb

4.23 KB
Binary file not shown.

recursive_verification/contract/Nargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ type = "contract"
44
authors = ["Satyam Bansal"]
55

66
[dependencies]
7-
aztec = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v2.0.3", directory = "noir-projects/aztec-nr/aztec" }
8-
value_note = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v2.0.3", directory = "noir-projects/aztec-nr/value-note" }
9-
easy_private_state = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v2.0.3", directory = "noir-projects/aztec-nr/easy-private-state" }
7+
aztec = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v3.0.0-nightly.20251026", directory = "noir-projects/aztec-nr/aztec" }
8+
value_note = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v3.0.0-nightly.20251026", directory = "noir-projects/aztec-nr/value-note" }
9+
easy_private_state = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v3.0.0-nightly.20251026", directory = "noir-projects/aztec-nr/easy-private-state" }

recursive_verification/contract/src/main.nr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub contract ValueNotEqual {
77
global HONK_IDENTIFIER: u32 = 1;
88

99
use aztec::{
10-
macros::{functions::{initializer, private, public, utility}, storage::storage},
10+
macros::{functions::{external, initializer}, storage::storage},
1111
oracle::debug_log::debug_log_format,
1212
protocol_types::{address::AztecAddress, traits::ToField},
1313
state_vars::Map,
@@ -20,13 +20,13 @@ pub contract ValueNotEqual {
2020
}
2121

2222
#[initializer]
23-
#[private]
23+
#[external("private")]
2424
fn initialize(headstart: u64, owner: AztecAddress) {
2525
let counters = storage.counters;
2626
counters.at(owner).add(headstart, owner);
2727
}
2828

29-
#[private]
29+
#[external("private")]
3030
fn increment(
3131
owner: AztecAddress,
3232
verification_key: [Field; HONK_VK_SIZE],
@@ -40,12 +40,12 @@ pub contract ValueNotEqual {
4040
counters.at(owner).add(1, owner);
4141
}
4242

43-
#[public]
43+
#[external("public")]
4444
fn emit_in_public(n: Field) {
4545
context.push_note_hash(n);
4646
}
4747

48-
#[utility]
48+
#[external("utility")]
4949
unconstrained fn get_counter(owner: AztecAddress) -> Field {
5050
storage.counters.at(owner).get_value()
5151
}

recursive_verification/data.json

Lines changed: 510 additions & 1 deletion
Large diffs are not rendered by default.

recursive_verification/package.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"clean": "rm -rf store",
77
"cli": "bun run cli.ts",
88
"ccc": "cd contract && aztec-nargo compile && aztec-postprocess-contract && aztec codegen target -o artifacts",
9+
"bb-download-debug": "curl -L https://github.com/AztecProtocol/aztec-packages/releases/download/v3.0.0-nightly.20251026/barretenberg-threads-debug-wasm.tar.gz -o barretenberg-debug.wasm.gz && tar -xzvf barretenberg-debug.wasm.gz",
10+
"recursion:debug": "bun run bb-download-debug && BB_WASM_PATH=\"$(pwd)/barretenberg-debug.wasm\" LOG_LEVEL=verbose bun run recursion",
911
"data": "bun run scripts/generate_data.ts",
1012
"recursion": "tsx scripts/run_recursion.ts",
1113
"test": "bun clean && bun test",
@@ -18,14 +20,14 @@
1820
"typescript": "^5.0.0"
1921
},
2022
"dependencies": {
21-
"@aztec/accounts": "3.0.0-nightly.20251024",
22-
"@aztec/aztec.js": "3.0.0-nightly.20251024",
23-
"@aztec/bb.js": "3.0.0-nightly.20251024",
24-
"@aztec/kv-store": "3.0.0-nightly.20251024",
25-
"@aztec/noir-contracts.js": "3.0.0-nightly.20251024",
26-
"@aztec/noir-noir_js": "3.0.0-nightly.20251024",
27-
"@aztec/pxe": "3.0.0-nightly.20251024",
28-
"@aztec/test-wallet": "3.0.0-nightly.20251024",
23+
"@aztec/accounts": "3.0.0-nightly.20251026",
24+
"@aztec/aztec.js": "3.0.0-nightly.20251026",
25+
"@aztec/bb.js": "3.0.0-nightly.20251026",
26+
"@aztec/kv-store": "3.0.0-nightly.20251026",
27+
"@aztec/noir-contracts.js": "3.0.0-nightly.20251026",
28+
"@aztec/noir-noir_js": "3.0.0-nightly.20251026",
29+
"@aztec/pxe": "3.0.0-nightly.20251026",
30+
"@aztec/test-wallet": "3.0.0-nightly.20251026",
2931
"add": "^2.0.6",
3032
"tsx": "^4.20.6"
3133
}

recursive_verification/scripts/generate_data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const proofAsFields = deflattenFields(mainProofData.proof)
2020
const barretenbergAPI = await Barretenberg.new({ threads: 1 });
2121

2222
// write recursive proof artifacts and public inputs to file, add pu
23-
fs.writeFileSync('data.json', JSON.stringify({ ...recursiveProofArtifacts, publicInputs: mainProofData.publicInputs }, null, 2))
23+
fs.writeFileSync('data.json', JSON.stringify({ ...recursiveProofArtifacts, proofAsFields, publicInputs: mainProofData.publicInputs }, null, 2))
2424
await barretenbergAPI.destroy()
2525
console.log("Done")
2626
exit()
Lines changed: 60 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,86 @@
1-
import { Contract } from "@aztec/aztec.js/contracts"
2-
import { createAztecNodeClient } from "@aztec/aztec.js/node"
3-
import { SponsoredFeePaymentMethod } from "@aztec/aztec.js/fee"
4-
import type { FieldLike } from "@aztec/aztec.js/abi"
1+
import { createAztecNodeClient } from "@aztec/aztec.js/node";
2+
import { SponsoredFeePaymentMethod } from "@aztec/aztec.js/fee";
3+
import type { FieldLike } from "@aztec/aztec.js/abi";
54
import { getSponsoredFPCInstance } from "./sponsored_fpc.js";
65
import { SponsoredFPCContract } from "@aztec/noir-contracts.js/SponsoredFPC";
7-
export const PXE_URL = 'http://localhost:8080'
8-
import { ValueNotEqualContract, ValueNotEqualContractArtifact } from '../contract/artifacts/ValueNotEqual'
9-
import data from '../data.json'
10-
import { getPXEConfig } from "@aztec/pxe/config"
11-
import { TestWallet } from '@aztec/test-wallet/server';
12-
import { AztecAddress } from "@aztec/aztec.js/addresses"
6+
export const PXE_URL = "http://localhost:8080";
7+
import { ValueNotEqualContract } from "../contract/artifacts/ValueNotEqual";
8+
import data from "../data.json";
9+
import { getPXEConfig } from "@aztec/pxe/config";
10+
import { TestWallet } from "@aztec/test-wallet/server";
11+
import { AztecAddress } from "@aztec/aztec.js/addresses";
12+
import { rm } from "node:fs/promises";
1313

1414
const sponsoredFPC = await getSponsoredFPCInstance();
15-
const sponsoredPaymentMethod = new SponsoredFeePaymentMethod(sponsoredFPC.address);
15+
const sponsoredPaymentMethod = new SponsoredFeePaymentMethod(
16+
sponsoredFPC.address
17+
);
1618

1719
export const setupSandbox = async (): Promise<TestWallet> => {
18-
1920
try {
20-
const nodeUrl = 'http://localhost:8080';
21+
const nodeUrl = "http://localhost:8080";
2122
const aztecNode = await createAztecNodeClient(nodeUrl);
2223
const config = getPXEConfig();
23-
config.dataDirectory = 'pxe';
24+
await rm("pxe", { recursive: true, force: true });
25+
config.dataDirectory = "pxe";
2426
config.proverEnabled = true;
2527
let wallet = await TestWallet.create(aztecNode, config);
26-
await wallet.registerContract({ instance: sponsoredFPC, artifact: SponsoredFPCContract.artifact });
28+
await wallet.registerContract({
29+
instance: sponsoredFPC,
30+
artifact: SponsoredFPCContract.artifact,
31+
});
2732

2833
return wallet;
2934
} catch (error) {
30-
console.error('Failed to setup sandbox:', error)
31-
throw error
35+
console.error("Failed to setup sandbox:", error);
36+
throw error;
3237
}
33-
}
34-
38+
};
3539

3640
async function main() {
3741
const testWallet = await setupSandbox();
3842
const account = await testWallet.createAccount();
3943
const manager = await account.getDeployMethod();
40-
await manager.send({ from: AztecAddress.ZERO, fee: { paymentMethod: sponsoredPaymentMethod } }).deployed()
44+
await manager
45+
.send({
46+
from: AztecAddress.ZERO,
47+
fee: { paymentMethod: sponsoredPaymentMethod },
48+
})
49+
.deployed();
4150
const accounts = await testWallet.getAccounts();
4251

43-
const valueNotEqual = await ValueNotEqualContract.deploy(testWallet, 10, accounts[0].item).send({ from: accounts[0].item, fee: { paymentMethod: sponsoredPaymentMethod } }).deployed()
52+
const valueNotEqual = await ValueNotEqualContract.deploy(
53+
testWallet,
54+
10,
55+
accounts[0].item
56+
)
57+
.send({
58+
from: accounts[0].item,
59+
fee: { paymentMethod: sponsoredPaymentMethod },
60+
})
61+
.deployed();
4462

45-
const tx = await valueNotEqual.methods.increment(accounts[0].item, data.vkAsFields as unknown as FieldLike[], data.proofAsFields as unknown as FieldLike[], data.publicInputs as unknown as FieldLike[]).send({ from: accounts[0].item, fee: { paymentMethod: sponsoredPaymentMethod } }).wait()
63+
const tx = await valueNotEqual.methods
64+
.increment(
65+
accounts[0].item,
66+
data.vkAsFields as unknown as FieldLike[],
67+
data.proofAsFields as unknown as FieldLike[],
68+
data.publicInputs as unknown as FieldLike[]
69+
)
70+
.send({
71+
from: accounts[0].item,
72+
fee: { paymentMethod: sponsoredPaymentMethod },
73+
})
74+
.wait();
4675

47-
console.log(`Tx hash: ${tx.txHash.toString()}`)
48-
const counterValue = await valueNotEqual.methods.get_counter(accounts[0].item).simulate({ from: accounts[0].item })
49-
console.log(`Counter value: ${counterValue}`)
76+
console.log(`Tx hash: ${tx.txHash.toString()}`);
77+
const counterValue = await valueNotEqual.methods
78+
.get_counter(accounts[0].item)
79+
.simulate({ from: accounts[0].item });
80+
console.log(`Counter value: ${counterValue}`);
5081
}
5182

52-
main().catch(error => {
53-
console.error(error)
54-
process.exit(1)
55-
})
83+
main().catch((error) => {
84+
console.error(error);
85+
process.exit(1);
86+
});

0 commit comments

Comments
 (0)