Skip to content

Commit 6f14716

Browse files
committed
0.86.0
1 parent 8b038c9 commit 6f14716

File tree

10 files changed

+598
-253
lines changed

10 files changed

+598
-253
lines changed

apps/interface/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
"_chore": "pnpm i"
1515
},
1616
"dependencies": {
17-
"@aztec/aztec.js": "0.80.0",
18-
"@aztec/foundation": "0.80.0",
17+
"@aztec/aztec.js": "0.86.0",
18+
"@aztec/foundation": "0.86.0",
1919
"@hpke/core": "^1.7.1",
2020
"@hpke/dhkem-x25519": "^1.6.1",
21-
"@noir-lang/acvm_js": "1.0.0-beta.3",
22-
"@noir-lang/noir_js": "1.0.0-beta.3",
23-
"@noir-lang/noirc_abi": "1.0.0-beta.3",
21+
"@noir-lang/acvm_js": "1.0.0-beta.5",
22+
"@noir-lang/noir_js": "1.0.0-beta.5",
23+
"@noir-lang/noirc_abi": "1.0.0-beta.5",
2424
"@reown/walletkit": "^1.1.1",
2525
"@repo/contracts": "workspace:*",
2626
"@repo/ui": "workspace:*",

packages/contracts/hardhat.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import "@nomicfoundation/hardhat-toolbox";
22
import "hardhat-deploy";
3-
import "hardhat-plugin-noir";
3+
import "hardhat-noir";
44
import { HardhatUserConfig } from "hardhat/config";
55
import envConfig from "./envConfig";
66
import "./shared/typed-hardhat-deploy";
@@ -16,7 +16,7 @@ const config: HardhatUserConfig = {
1616
},
1717
},
1818
noir: {
19-
version: "1.0.0-beta.3",
19+
version: "1.0.0-beta.5",
2020
},
2121
networks: {},
2222
etherscan: {

packages/contracts/noir/common/Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ type = "lib"
44
authors = ["Oleh Misarosh <[email protected]>"]
55

66
[dependencies]
7-
protocol_types = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v0.80.0", directory = "noir-projects/noir-protocol-circuits/crates/types" }
7+
protocol_types = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v0.86.0", directory = "noir-projects/noir-protocol-circuits/crates/types" }
88
bignum = { tag = "v0.6.1", git = "https://github.com/noir-lang/noir-bignum/" }
99
nodash = { tag = "v0.40.2", git = "https://github.com/olehmisar/nodash/" }

packages/contracts/noir/rollup/Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ type = "bin"
44
authors = ["Oleh Misarosh <[email protected]"]
55

66
[dependencies]
7-
protocol_types = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v0.80.0", directory = "noir-projects/noir-protocol-circuits/crates/types" }
7+
protocol_types = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v0.86.0", directory = "noir-projects/noir-protocol-circuits/crates/types" }
88
common = { path = "../common" }

packages/contracts/package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"hardhat": "^2.22.16",
3030
"hardhat-deploy": "^0.11.45",
3131
"hardhat-gas-reporter": "^1.0.10",
32-
"hardhat-plugin-noir": "^0.4.0",
32+
"hardhat-noir": "^0.5.0",
3333
"json-stringify-deterministic": "^1.0.12",
3434
"lodash": "^4.17.21",
3535
"ms": "^2.1.3",
@@ -43,19 +43,20 @@
4343
"typescript": "^5.3.3"
4444
},
4545
"dependencies": {
46-
"@aztec/aztec.js": "0.80.0",
47-
"@aztec/bb.js": "0.80.0",
48-
"@aztec/foundation": "0.80.0",
49-
"@aztec/kv-store": "0.80.0",
50-
"@aztec/merkle-tree": "0.80.0",
51-
"@aztec/stdlib": "0.80.0",
46+
"@aztec/aztec.js": "0.86.0",
47+
"@aztec/bb.js": "0.86.0",
48+
"@aztec/foundation": "0.86.0",
49+
"@aztec/kv-store": "0.86.0",
50+
"@aztec/merkle-tree": "0.86.0",
51+
"@aztec/stdlib": "0.86.0",
5252
"@hpke/core": "^1.7.1",
5353
"@hpke/dhkem-x25519": "^1.6.1",
54-
"@noir-lang/noir_js": "1.0.0-beta.3",
54+
"@noir-lang/noir_js": "1.0.0-beta.5",
5555
"@repo/utils": "workspace:*",
5656
"ethers": "^6.13.4",
5757
"ky": "^1.7.2",
5858
"lodash-es": "^4.17.21",
59+
"ox": "^0.7.2",
5960
"ts-essentials": "^9.4.1",
6061
"zod": "^3.23.8"
6162
}

packages/contracts/sdk/NativeUltraHonkBackend.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import type { ProofData } from "@aztec/bb.js";
22
import type { CompiledCircuit } from "@noir-lang/noir_js";
3+
import { chunk } from "lodash-es";
34
import { spawn } from "node:child_process";
45
import fs from "node:fs";
56
import path from "node:path";
6-
import { decodeNativeHonkProof } from "./utils.js";
7+
import { Hex } from "ox";
8+
import { assert } from "ts-essentials";
79

810
export class NativeUltraHonkBackend {
911
constructor(
@@ -32,13 +34,17 @@ export class NativeUltraHonkBackend {
3234
fs.writeFileSync(circuitJsonPath, JSON.stringify(this.circuit));
3335
fs.writeFileSync(witnessOutputPath, witness);
3436
const args = [
35-
"prove_ultra_keccak_honk",
37+
"prove",
38+
"--scheme",
39+
"ultra_honk",
3640
"-b",
3741
circuitJsonPath,
3842
"-w",
3943
witnessOutputPath,
4044
"-o",
4145
proofOutputPath,
46+
"--oracle_hash",
47+
"keccak",
4248
];
4349

4450
const bbProcess = spawn(this.bbPath, args);
@@ -57,10 +63,21 @@ export class NativeUltraHonkBackend {
5763
return;
5864
}
5965

60-
const proofData = decodeNativeHonkProof(
61-
fs.readFileSync(proofOutputPath),
66+
const proof = fs.readFileSync(path.join(proofOutputPath, "proof"));
67+
const publicInputs = fs.readFileSync(
68+
path.join(proofOutputPath, "public_inputs"),
6269
);
63-
resolve(proofData);
70+
assert(
71+
publicInputs.length % 32 === 0,
72+
"publicInputs length must be divisible by 32",
73+
);
74+
resolve({
75+
proof,
76+
// TODO: not sure if this publicInputs decoding is correct
77+
publicInputs: chunk(Array.from(publicInputs), 32).map((x) =>
78+
Hex.fromBytes(Uint8Array.from(x)),
79+
),
80+
});
6481
});
6582

6683
bbProcess.on("error", (err) => {

packages/contracts/sdk/backendSdk.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { UltraHonkBackend } from "@aztec/bb.js";
2+
import type { CompiledCircuit } from "@noir-lang/noir_js";
23
import { utils } from "@repo/utils";
34
import os from "node:os";
45
import type { AsyncOrSync } from "ts-essentials";
56
import { NativeUltraHonkBackend } from "./NativeUltraHonkBackend";
67
import { RollupService } from "./RollupOnlyService";
7-
import { type CompiledCircuit, createCoreSdk } from "./sdk";
8+
import { createCoreSdk } from "./sdk";
89
import type { TreesService } from "./TreesService";
910

1011
export function createBackendSdk(

packages/contracts/sdk/sdk.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { CompiledCircuit } from "@noir-lang/noir_js";
12
import { ethers } from "ethers";
23
import { mapValues } from "lodash-es";
34
import type { AsyncOrSync } from "ts-essentials";
@@ -43,11 +44,6 @@ export function createInterfaceSdk(
4344
};
4445
}
4546

46-
export type CompiledCircuit = {
47-
bytecode: string;
48-
abi: any;
49-
};
50-
5147
async function getCircuit(artifact: AsyncOrSync<CompiledCircuit>) {
5248
const { Noir } = await import("@noir-lang/noir_js");
5349
const { UltraHonkBackend } = await import("@aztec/bb.js");

packages/contracts/sdk/utils.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Fr } from "@aztec/aztec.js";
2-
import { splitHonkProof } from "@aztec/bb.js";
32
import type { InputMap } from "@noir-lang/noir_js";
43
import { ethers } from "ethers";
54
import { assert } from "ts-essentials";
@@ -75,25 +74,5 @@ export async function prove(
7574
keccak: true,
7675
});
7776
console.timeEnd(`${name} generateProof`);
78-
proof = proof.slice(4); // remove length
7977
return { proof, witness, returnValue, publicInputs };
8078
}
81-
82-
export function decodeNativeHonkProof(nativeProof: Uint8Array) {
83-
const { proof, publicInputs: publicInputsRaw } = splitHonkProof(nativeProof);
84-
const publicInputs = deflattenFields(publicInputsRaw);
85-
return { proof, publicInputs };
86-
}
87-
88-
// TODO: import from @aztec/bb.js when available
89-
function deflattenFields(flattenedFields: Uint8Array): string[] {
90-
const publicInputSize = 32;
91-
const chunkedFlattenedPublicInputs: Uint8Array[] = [];
92-
93-
for (let i = 0; i < flattenedFields.length; i += publicInputSize) {
94-
const publicInput = flattenedFields.slice(i, i + publicInputSize);
95-
chunkedFlattenedPublicInputs.push(publicInput);
96-
}
97-
98-
return chunkedFlattenedPublicInputs.map((x) => ethers.hexlify(x));
99-
}

0 commit comments

Comments
 (0)