diff --git a/app/App.tsx b/app/App.tsx index fabaa4a..c6ec492 100644 --- a/app/App.tsx +++ b/app/App.tsx @@ -21,7 +21,7 @@ export default function Home() { useEffect(() => { async function run() { // Initialize the WASM module - await init() + await init(undefined, new WebAssembly.Memory({initial:20,maximum:1024,shared:true})) } run() }) diff --git a/package.json b/package.json index 1ce171d..5d94270 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "test": "jest" }, "dependencies": { - "@ezkljs/engine": "1.13.4", + "@ezkljs/engine": "1.13.3", "@ezkljs/verify": "^0.0.4", "@types/file-saver": "^2.0.5", "@types/json-bigint": "^1.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ba1ee90..fbbf74b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,8 +6,8 @@ settings: dependencies: '@ezkljs/engine': - specifier: 1.13.4 - version: 1.13.4 + specifier: 1.13.3 + version: 1.13.3 '@ezkljs/verify': specifier: ^0.0.4 version: 0.0.4 @@ -774,8 +774,8 @@ packages: resolution: {integrity: sha512-3w+KSLkwwa/aS6PZvna+tHGcHqCU1V7tPu55M0hq+7pc9xRqQoch6zfOiuEKAFWOcSe3oTSR7Myhz90uE9DW9Q==} dev: false - /@ezkljs/engine@1.13.4: - resolution: {integrity: sha512-LRrLiw4KDxkJ6veRtiBgMoeGYQnwNUDRL4AhsBXEpR4C6MchLlvQGYxtMcpvkNXCVulaEWXZGNHz6mt7oEHbGw==} + /@ezkljs/engine@1.13.3: + resolution: {integrity: sha512-y2/mr0LOP/DEUqn0LGf1P6dqdUuEzTURD3Vj1p3J47SHQODtamT9ZloWC6PuFDxah0YMwaORcFzetQVkwehKkQ==} dev: false /@ezkljs/verify@0.0.4: diff --git a/public/data/settings.json b/public/data/settings.json index 014d017..2ade7bf 100644 --- a/public/data/settings.json +++ b/public/data/settings.json @@ -10,7 +10,12 @@ "scale": 0, "bits": 5, "logrows": 7, - "batch_size": 1, + "variables": [ + [ + "batch_size", + 1 + ] + ], "input_visibility": "Private", "output_visibility": "Public", "param_visibility": "Private" diff --git a/public/data/test_network.compiled b/public/data/test_network.compiled index 4b39e72..f96a247 100644 Binary files a/public/data/test_network.compiled and b/public/data/test_network.compiled differ diff --git a/tests/wasmFunctions.test.ts b/tests/wasmFunctions.test.ts index 0fe1481..f21c220 100644 --- a/tests/wasmFunctions.test.ts +++ b/tests/wasmFunctions.test.ts @@ -67,33 +67,33 @@ describe('wasmFunctions', () => { }); }); - // describe('Prove and verify', () => { - - // let proof_ser: Uint8ClampedArray - - // let circuit_settings_ser: Uint8ClampedArray; - // let params_ser: Uint8ClampedArray; - - // it('prove', async () => { - // const witness = await readDataFile('test.witness.json'); - // const pk = await readDataFile('test.provekey'); - // const circuit_ser = await readDataFile('test_network.compiled'); - // circuit_settings_ser = await readDataFile('settings.json'); - // params_ser = await readDataFile('kzg'); - // const result = wasmFunctions.prove(witness, pk, circuit_ser, circuit_settings_ser, params_ser); - // proof_ser = new Uint8ClampedArray(result.buffer); - // const proof = uint8ArrayToJsonObject(result) - // console.log("Proof", proof) - // expect(result).toBeInstanceOf(Uint8Array); - // }); - - // it('verify', async() => { - // const vk = await readDataFile('test.key'); - // const result = wasmFunctions.verify(proof_ser, vk, circuit_settings_ser, params_ser); - // expect(typeof result).toBe('boolean'); - // expect(result).toBe(true); - // }); - // }); + describe('Prove and verify', () => { + + let proof_ser: Uint8ClampedArray + + let circuit_settings_ser: Uint8ClampedArray; + let params_ser: Uint8ClampedArray; + + it('prove', async () => { + const witness = await readDataFile('test.witness.json'); + const pk = await readDataFile('test.provekey'); + const circuit_ser = await readDataFile('test_network.compiled'); + circuit_settings_ser = await readDataFile('settings.json'); + params_ser = await readDataFile('kzg'); + const result = wasmFunctions.prove(witness, pk, circuit_ser, circuit_settings_ser, params_ser); + proof_ser = new Uint8ClampedArray(result.buffer); + const proof = uint8ArrayToJsonObject(result) + console.log("Proof", proof) + expect(result).toBeInstanceOf(Uint8Array); + }); + + it('verify', async() => { + const vk = await readDataFile('test.key'); + const result = wasmFunctions.verify(proof_ser, vk, circuit_settings_ser, params_ser); + expect(typeof result).toBe('boolean'); + expect(result).toBe(true); + }); + }); describe('Field element utils', () => {