diff --git a/packages/proof/src/groth16/verify.ts b/packages/proof/src/groth16/verify.ts index e58330d6a..4ab5fd0f6 100644 --- a/packages/proof/src/groth16/verify.ts +++ b/packages/proof/src/groth16/verify.ts @@ -27,7 +27,8 @@ export default async function groth16Verify(_vk_verifier: any, _publicSignals: a const proof = unstringifyBigInts(_proof) const publicSignals = unstringifyBigInts(_publicSignals) - const curve = await buildBn128(undefined, undefined) + // @ts-ignore + const curve = globalThis.curve_bn128 ?? (await buildBn128(undefined, undefined)) const IC0 = curve.G1.fromObject(vk_verifier.IC[0]) const IC = new Uint8Array(curve.G1.F.n8 * 2 * publicSignals.length) diff --git a/packages/proof/src/groth16/zkey-utils.ts b/packages/proof/src/groth16/zkey-utils.ts index 174726fdb..c3b245a28 100644 --- a/packages/proof/src/groth16/zkey-utils.ts +++ b/packages/proof/src/groth16/zkey-utils.ts @@ -31,7 +31,10 @@ async function readHeaderGroth16(fd: any, sections: any, toObject: any) { const n8r = await fd.readULE32() zkey.n8r = n8r zkey.r = await binFileUtils.readBigInt(fd, n8r) - zkey.curve = await buildBn128(undefined, undefined) + + // @ts-ignore + zkey.curve = globalThis.curve_bn128 ?? (await buildBn128(undefined, undefined)) + zkey.nVars = await fd.readULE32() zkey.nPublic = await fd.readULE32() zkey.domainSize = await fd.readULE32()