Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions yarn-project/ivc-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@
}
]
},
"reporters": [
"default"
],

"testTimeout": 120000,
"setupFiles": [
"../../foundation/src/jest/setup.mjs"
Expand Down
20 changes: 20 additions & 0 deletions yarn-project/ivc-integration/src/prove_wasm.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
import { ClientIvcProof } from '@aztec/stdlib/proofs';

import { ungzip } from 'pako';

function base64ToUint8Array(base64: string): Uint8Array {
return Uint8Array.from(atob(base64), c => c.charCodeAt(0));
}

export async function proveClientIVC(
bytecodes: string[],
witnessStack: Uint8Array[],
threads?: number,
): Promise<ClientIvcProof> {
const { AztecClientBackend } = await import('@aztec/bb.js');
const backend = new AztecClientBackend(
bytecodes.map(base64ToUint8Array).map((arr: Uint8Array) => ungzip(arr)),
{ threads },
);
try {
const [proof] = await backend.prove(witnessStack.map((arr: Uint8Array) => ungzip(arr)));
return new ClientIvcProof(Buffer.from(proof));
} finally {
await backend.destroy();
}
}

export async function proveThenVerifyAztecClient(
bytecodes: string[],
witnessStack: Uint8Array[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
witnessGenMockRollupRootCircuit,
} from './index.js';
import { proveAvm, proveClientIVC, proveRollupHonk, proveTube } from './prove_native.js';
import { proveClientIVC as proveClientIVCWASM } from './prove_wasm.js';
import type { KernelPublicInputs } from './types/index.js';

/* eslint-disable camelcase */
Expand Down Expand Up @@ -58,7 +59,7 @@ describe('Rollup IVC Integration', () => {

const [bytecodes, witnessStack, tailPublicInputs] = await generate3FunctionTestingIVCStack();
clientIVCPublicInputs = tailPublicInputs;
const proof = await proveClientIVC(bbBinaryPath, clientIVCWorkingDirectory, witnessStack, bytecodes, logger);
const proof = await proveClientIVCWASM(bytecodes, witnessStack, 16);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should be able to run LOG_LEVEL=debug yarn test to test this rigged thing given the modifications in package.json

await writeClientIVCProofToOutputDirectory(proof, clientIVCWorkingDirectory);
const verifyResult = await verifyClientIvcProof(
bbBinaryPath,
Expand Down