diff --git a/barretenberg/ts/src/barretenberg/backend.ts b/barretenberg/ts/src/barretenberg/backend.ts index 546b6738f6b..a92a7fa98a5 100644 --- a/barretenberg/ts/src/barretenberg/backend.ts +++ b/barretenberg/ts/src/barretenberg/backend.ts @@ -265,13 +265,16 @@ export class UltraHonkBackend { // eslint-disable-next-line @typescript-eslint/no-unused-vars _numOfPublicInputs: number, ): Promise<{ proofAsFields: string[]; vkAsFields: string[]; vkHash: string }> { + console.log(`instantiating...`); await this.instantiate(); + console.log(`instanted`); // TODO(https://github.com/noir-lang/noir/issues/5661): This needs to be updated to handle recursive aggregation. // There is still a proofAsFields method but we could consider getting rid of it as the proof itself // is a list of field elements. // UltraHonk also does not have public inputs directly prepended to the proof and they are still instead // inserted at an offset. - // const proof = reconstructProofWithPublicInputs(proofData); + const proof = await this.api.acirProofAsFieldsUltraHonk(_proof); + console.log(`converted proof`); // const proofAsFields = (await this.api.acirProofAsFieldsUltraHonk(proof)).slice(numOfPublicInputs); // TODO: perhaps we should put this in the init function. Need to benchmark @@ -281,12 +284,12 @@ export class UltraHonkBackend { return { // TODO(https://github.com/noir-lang/noir/issues/5661) - proofAsFields: [], + proofAsFields: proof.map(proof=>proof.toString()), vkAsFields: vk.map(vk => vk.toString()), // We use an empty string for the vk hash here as it is unneeded as part of the recursive artifacts // The user can be expected to hash the vk inside their circuit to check whether the vk is the circuit // they expect - vkHash: '', + vkHash: '0x404', }; } diff --git a/barretenberg/ts/src/barretenberg_api/index.ts b/barretenberg/ts/src/barretenberg_api/index.ts index 4bd05354276..684653a785e 100644 --- a/barretenberg/ts/src/barretenberg_api/index.ts +++ b/barretenberg/ts/src/barretenberg_api/index.ts @@ -667,8 +667,11 @@ export class BarretenbergApi { } async acirProofAsFieldsUltraHonk(proofBuf: Uint8Array): Promise { + console.log("defining inArgs"); const inArgs = [proofBuf].map(serializeBufferable); + console.log("defining outTypes"); const outTypes: OutputType[] = [VectorDeserializer(Fr)]; + console.log("calling wasm export"); const result = await this.wasm.callWasmExport( 'acir_proof_as_fields_ultra_honk', inArgs, diff --git a/yarn-project/bb-bench/browser/src/main.js b/yarn-project/bb-bench/browser/src/main.js index a31d1b06531..b3879ed7d1f 100644 --- a/yarn-project/bb-bench/browser/src/main.js +++ b/yarn-project/bb-bench/browser/src/main.js @@ -1,4 +1,4 @@ -import { UltraPlonkBackend } from '@aztec/bb.js'; +import { UltraHonkBackend } from '@aztec/bb.js'; import { Noir } from '@noir-lang/noir_js'; @@ -18,7 +18,7 @@ document.getElementById('bbProveSingle').addEventListener('click', async () => { const prove = async threads => { console.log(`Running with ${threads} threads`); try { - var backend = new UltraPlonkBackend(main.bytecode, { threads }, { recursive: true }); + var backend = new UltraHonkBackend(main.bytecode, { threads }, { recursive: true }); var noir = new Noir(main); const baseInput = { x: 1, @@ -43,13 +43,10 @@ const prove = async threads => { var isValid = await backend.verifyProof(baseProof); if (isValid) console.log('Verifying base proof... ✅'); - const proofArtifacts = await backend.generateRecursiveProofArtifacts( - baseProof, - 1, // 1 public input - ); + const proofArtifacts = await backend.generateRecursiveProofArtifacts(baseProof.proof, baseProof.publicInputs); // generate the recursion proof - backend = new UltraPlonkBackend(recursion.bytecode, { threads: threads }, { recursive: false }); + backend = new UltraHonkBackend(recursion.bytecode, { threads: threads }, { recursive: false }); noir = new Noir(recursion); const { publicInputs } = baseProof; const { vkAsFields, proofAsFields, vkHash } = proofArtifacts; diff --git a/yarn-project/bb-bench/recursion/src/main.nr b/yarn-project/bb-bench/recursion/src/main.nr index 0d508e1b24e..d0f027517b4 100644 --- a/yarn-project/bb-bench/recursion/src/main.nr +++ b/yarn-project/bb-bench/recursion/src/main.nr @@ -16,6 +16,6 @@ fn main( proof, public_inputs, key_hash, - 0 // PROOF_TYPE_PLONK + 1 // PROOF_TYPE_HONK ); }