From e22f96b3a9b2ae760cbe8c8e31ffb34a9900aa2e Mon Sep 17 00:00:00 2001 From: Florian Date: Sat, 23 Nov 2024 16:03:14 +0700 Subject: [PATCH] add compilation test --- src/lib/proof-system/zkprogram.unit-test.ts | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/lib/proof-system/zkprogram.unit-test.ts diff --git a/src/lib/proof-system/zkprogram.unit-test.ts b/src/lib/proof-system/zkprogram.unit-test.ts new file mode 100644 index 000000000..0b36bef28 --- /dev/null +++ b/src/lib/proof-system/zkprogram.unit-test.ts @@ -0,0 +1,33 @@ +import { Field } from '../provable/wrapped.js'; +import { ZkProgram } from './zkprogram.js'; + +const methodCount = 30; + +let MyProgram = ZkProgram({ + name: 'large-program', + publicOutput: Field, + methods: nMethods(methodCount), +}); + +function nMethods(i: number) { + let methods: Record = {}; + for (let j = 0; j < i; j++) { + methods['method' + j] = { + privateInputs: [Field], + async method(a: Field) { + return { + publicOutput: a.mul(1), + }; + }, + }; + } + return methods; +} + +try { + await MyProgram.compile(); +} catch (error) { + throw Error( + `Could not compile zkProgram with ${methodCount} branches: ${error}` + ); +}