From b53480e6623e5b4e62b0f4d906f6986e994dbb6c Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 12 Nov 2024 19:48:56 +0000 Subject: [PATCH] Make path uniform for compiled circuit --- apps/circuit-compiler/src/app/services/circomPluginClient.ts | 2 +- .../templates/hashchecker/scripts/groth16/groth16_zkproof.ts | 2 +- .../src/templates/hashchecker/scripts/plonk/plonk_zkproof.ts | 2 +- .../src/templates/rln/scripts/groth16/groth16_zkproof.ts | 2 +- .../src/templates/rln/scripts/plonk/plonk_zkproof.ts | 2 +- .../templates/semaphore/scripts/groth16/groth16_zkproof.ts | 4 ++-- .../src/templates/semaphore/scripts/plonk/plonk_zkproof.ts | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/circuit-compiler/src/app/services/circomPluginClient.ts b/apps/circuit-compiler/src/app/services/circomPluginClient.ts index 4e5ee61229..6c8366c4a0 100644 --- a/apps/circuit-compiler/src/app/services/circomPluginClient.ts +++ b/apps/circuit-compiler/src/app/services/circomPluginClient.ts @@ -181,7 +181,7 @@ export class CircomPluginClient extends PluginClient { this.lastCompiledFile = path const fileName = extractNameFromKey(path) - this.lastCompiledCircuitPath = extractParentFromKey(path) + "/.bin/" + fileName.replace('circom', 'wasm') + this.lastCompiledCircuitPath = extractParentFromKey(path) + "/.bin/" + fileName.replace('.circom', '_js') + '/' + fileName.replace('circom', 'wasm') // @ts-ignore await this.call('fileManager', 'writeFile', this.lastCompiledCircuitPath, circuitProgram, { encoding: null }) const fileContent = this.lastParsedFiles[path] diff --git a/libs/remix-ws-templates/src/templates/hashchecker/scripts/groth16/groth16_zkproof.ts b/libs/remix-ws-templates/src/templates/hashchecker/scripts/groth16/groth16_zkproof.ts index 1072ea7873..1f7299f624 100644 --- a/libs/remix-ws-templates/src/templates/hashchecker/scripts/groth16/groth16_zkproof.ts +++ b/libs/remix-ws-templates/src/templates/hashchecker/scripts/groth16/groth16_zkproof.ts @@ -18,7 +18,7 @@ const logger = { // @ts-ignore await remix.call('circuit-compiler', 'compile', 'circuits/calculate_hash.circom'); // @ts-ignore - const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/calculate_hash.wasm', { encoding: null }); + const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/calculate_hash_js/calculate_hash.wasm', { encoding: null }); // @ts-ignore const wasm = new Uint8Array(wasmBuffer); diff --git a/libs/remix-ws-templates/src/templates/hashchecker/scripts/plonk/plonk_zkproof.ts b/libs/remix-ws-templates/src/templates/hashchecker/scripts/plonk/plonk_zkproof.ts index 3d6d7feadc..22952be645 100644 --- a/libs/remix-ws-templates/src/templates/hashchecker/scripts/plonk/plonk_zkproof.ts +++ b/libs/remix-ws-templates/src/templates/hashchecker/scripts/plonk/plonk_zkproof.ts @@ -15,7 +15,7 @@ const logger = { // @ts-ignore await remix.call('circuit-compiler', 'compile', 'circuits/calculate_hash.circom'); // @ts-ignore - const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/calculate_hash.wasm', { encoding: null }); + const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/calculate_hash_js/calculate_hash.wasm', { encoding: null }); // @ts-ignore const wasm = new Uint8Array(wasmBuffer); const zkey_final = { diff --git a/libs/remix-ws-templates/src/templates/rln/scripts/groth16/groth16_zkproof.ts b/libs/remix-ws-templates/src/templates/rln/scripts/groth16/groth16_zkproof.ts index 860c9dca61..ce02aba364 100644 --- a/libs/remix-ws-templates/src/templates/rln/scripts/groth16/groth16_zkproof.ts +++ b/libs/remix-ws-templates/src/templates/rln/scripts/groth16/groth16_zkproof.ts @@ -79,7 +79,7 @@ async function prove (signals, wasm, wtns, r1cs, zkey_final, vKey) { // @ts-ignore await remix.call('circuit-compiler', 'compile', 'circuits/rln.circom'); // @ts-ignore - const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/rln.wasm', { encoding: null }); + const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/rln_js/rln.wasm', { encoding: null }); // @ts-ignore const wasm = new Uint8Array(wasmBuffer); diff --git a/libs/remix-ws-templates/src/templates/rln/scripts/plonk/plonk_zkproof.ts b/libs/remix-ws-templates/src/templates/rln/scripts/plonk/plonk_zkproof.ts index 2f95cb5b82..1ca7d61116 100644 --- a/libs/remix-ws-templates/src/templates/rln/scripts/plonk/plonk_zkproof.ts +++ b/libs/remix-ws-templates/src/templates/rln/scripts/plonk/plonk_zkproof.ts @@ -102,7 +102,7 @@ async function prove (signals, wasm, wtns, r1cs, zkey_final, vKey) { // @ts-ignore await remix.call('circuit-compiler', 'compile', 'circuits/rln.circom'); // @ts-ignore - const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/rln.wasm', { encoding: null }); + const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/rln_js/rln.wasm', { encoding: null }); // @ts-ignore const wasm = new Uint8Array(wasmBuffer); diff --git a/libs/remix-ws-templates/src/templates/semaphore/scripts/groth16/groth16_zkproof.ts b/libs/remix-ws-templates/src/templates/semaphore/scripts/groth16/groth16_zkproof.ts index f395efe5f9..79e9679bb7 100644 --- a/libs/remix-ws-templates/src/templates/semaphore/scripts/groth16/groth16_zkproof.ts +++ b/libs/remix-ws-templates/src/templates/semaphore/scripts/groth16/groth16_zkproof.ts @@ -25,13 +25,13 @@ function hash(message: any): bigint { (async () => { try { // @ts-ignore - const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/semaphore.r1cs', true); + const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/semaphore.r1cs', { encoding: null }); // @ts-ignore const r1cs = new Uint8Array(r1csBuffer); // @ts-ignore await remix.call('circuit-compiler', 'compile', 'circuits/semaphore.circom'); // @ts-ignore - const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/semaphore.wasm', true); + const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/semaphore_js/semaphore.wasm', { encoding: null }); // @ts-ignore const wasm = new Uint8Array(wasmBuffer); diff --git a/libs/remix-ws-templates/src/templates/semaphore/scripts/plonk/plonk_zkproof.ts b/libs/remix-ws-templates/src/templates/semaphore/scripts/plonk/plonk_zkproof.ts index 77b996a402..8205b842d1 100644 --- a/libs/remix-ws-templates/src/templates/semaphore/scripts/plonk/plonk_zkproof.ts +++ b/libs/remix-ws-templates/src/templates/semaphore/scripts/plonk/plonk_zkproof.ts @@ -25,13 +25,13 @@ function hash(message: any): bigint { (async () => { try { // @ts-ignore - const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/semaphore.r1cs', true); + const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/semaphore.r1cs', { encoding: null }); // @ts-ignore const r1cs = new Uint8Array(r1csBuffer); // @ts-ignore await remix.call('circuit-compiler', 'compile', 'circuits/semaphore.circom'); // @ts-ignore - const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/semaphore.wasm', true); + const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/semaphore_js/semaphore.wasm', { encoding: null }); // @ts-ignore const wasm = new Uint8Array(wasmBuffer);