Do not use hidden path to fix windows

circom-desktop
ioedeveloper 4 weeks ago
parent cff213fb8f
commit 1789f79700
  1. 8
      apps/circuit-compiler/src/app/actions/index.ts
  2. 6
      apps/circuit-compiler/src/app/services/circomPluginClient.ts
  3. 18
      apps/remix-ide-e2e/src/tests/circom.test.ts
  4. 6
      apps/remixdesktop/src/plugins/circomElectronBasePlugin.ts
  5. 2
      libs/remix-ws-templates/src/templates/hashchecker/scripts/groth16/groth16_trusted_setup.ts
  6. 4
      libs/remix-ws-templates/src/templates/hashchecker/scripts/groth16/groth16_zkproof.ts
  7. 2
      libs/remix-ws-templates/src/templates/hashchecker/scripts/plonk/plonk_trusted_setup.ts
  8. 2
      libs/remix-ws-templates/src/templates/hashchecker/scripts/plonk/plonk_zkproof.ts
  9. 2
      libs/remix-ws-templates/src/templates/rln/scripts/groth16/groth16_trusted_setup.ts
  10. 4
      libs/remix-ws-templates/src/templates/rln/scripts/groth16/groth16_zkproof.ts
  11. 2
      libs/remix-ws-templates/src/templates/rln/scripts/plonk/plonk_trusted_setup.ts
  12. 4
      libs/remix-ws-templates/src/templates/rln/scripts/plonk/plonk_zkproof.ts
  13. 2
      libs/remix-ws-templates/src/templates/semaphore/scripts/groth16/groth16_trusted_setup.ts
  14. 4
      libs/remix-ws-templates/src/templates/semaphore/scripts/groth16/groth16_zkproof.ts
  15. 2
      libs/remix-ws-templates/src/templates/semaphore/scripts/plonk/plonk_trusted_setup.ts
  16. 4
      libs/remix-ws-templates/src/templates/semaphore/scripts/plonk/plonk_zkproof.ts
  17. 2
      libs/remix-ws-templates/src/templates/semaphore/scripts/run_setup.ts
  18. 4
      libs/remix-ws-templates/src/templates/semaphore/scripts/run_verification.ts

@ -29,7 +29,7 @@ export const computeWitness = async (plugin: CircomPluginClient, appState: AppSt
const wtns = await snarkjs.wtns.exportJson(witness)
const wtnsJson = wtns.map(wtn => wtn.toString())
const fileName = extractNameFromKey(appState.filePath)
const writePath = extractParentFromKey(appState.filePath) + `/.bin/${fileName.replace('.circom', '.wtn.json')}`
const writePath = extractParentFromKey(appState.filePath) + `/bin/${fileName.replace('.circom', '.wtn.json')}`
await plugin.call('fileManager', 'writeFile', writePath, JSON.stringify(wtnsJson, null, 2))
plugin._paq.push(['trackEvent', 'circuit-compiler', 'computeWitness', 'wtns.exportJson', writePath])
@ -53,7 +53,7 @@ export const runSetupAndExport = async (plugin: CircomPluginClient, appState: Ap
await plugin.generateR1cs(appState.filePath, { version: appState.version, prime: appState.primeValue })
const fileName = extractNameFromKey(appState.filePath)
const readPath = extractParentFromKey(appState.filePath) + `/.bin/${fileName.replace('.circom', '.r1cs')}`
const readPath = extractParentFromKey(appState.filePath) + `/bin/${fileName.replace('.circom', '.r1cs')}`
// @ts-ignore
const r1csBuffer = await plugin.call('fileManager', 'readFile', readPath, { encoding: null })
// @ts-ignore
@ -112,12 +112,12 @@ export const generateProof = async (plugin: CircomPluginClient, appState: AppSta
dispatch({ type: 'SET_PROOF_FEEDBACK', payload: null })
plugin.emit('statusChanged', { key: 'none' })
const fileName = extractNameFromKey(appState.filePath)
const r1csPath = extractParentFromKey(appState.filePath) + `/.bin/${fileName.replace('.circom', '.r1cs')}`
const r1csPath = extractParentFromKey(appState.filePath) + `/bin/${fileName.replace('.circom', '.r1cs')}`
// @ts-ignore
const r1csBuffer = await plugin.call('fileManager', 'readFile', r1csPath, { encoding: null })
// @ts-ignore
const r1cs = new Uint8Array(r1csBuffer)
const wtnsPath = isElectron() ? extractParentFromKey(appState.filePath) + "/.bin/" + fileName.replace('.circom', '_js') + "/" + fileName.replace('.circom', '.wtn') : r1csPath.replace('.r1cs', '.wtn')
const wtnsPath = isElectron() ? extractParentFromKey(appState.filePath) + "/bin/" + fileName.replace('.circom', '_js') + "/" + fileName.replace('.circom', '.wtn') : r1csPath.replace('.r1cs', '.wtn')
// @ts-ignore
const wtnsBuffer = await plugin.call('fileManager', 'readFile', wtnsPath, { encoding: null })
// @ts-ignore

@ -158,7 +158,7 @@ export class CircomPluginClient extends PluginClient {
const { stdout, stderr } = await this.call('circom', 'run', path, versionToInstall, { prime: prime, wasm: "", inputs: "" })
const fileName = extractNameFromKey(path)
this.lastCompiledCircuitPath = pathModule.normalize(extractParentFromKey(path) + "/.bin/" + fileName.replace('.circom', '_js') + "/" + fileName.replace('circom', 'wasm'))
this.lastCompiledCircuitPath = pathModule.normalize(extractParentFromKey(path) + "/bin/" + fileName.replace('.circom', '_js') + "/" + fileName.replace('circom', 'wasm'))
if (stderr) this.call('terminal', 'log', { type: 'error', value: stderr })
if (stdout) this.call('terminal', 'log', { type: 'log', value: stdout })
} catch (error) {
@ -212,7 +212,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', 'wasm')
// @ts-ignore
await this.call('fileManager', 'writeFile', this.lastCompiledCircuitPath, circuitProgram, { encoding: null })
const fileContent = this.lastParsedFiles[path]
@ -279,7 +279,7 @@ export class CircomPluginClient extends PluginClient {
throw new Error(r1csErrors)
} else {
const fileName = extractNameFromKey(path)
const writePath = extractParentFromKey(path) + "/.bin/" + fileName.replace('circom', 'r1cs')
const writePath = extractParentFromKey(path) + "/bin/" + fileName.replace('circom', 'r1cs')
// @ts-ignore
await this.call('fileManager', 'writeFile', writePath, r1csProgram, true)

@ -38,8 +38,8 @@ module.exports = {
.waitForElementPresent('[data-id="verticalIconsKindcircuit-compiler"]')
.waitForElementVisible('[data-id="verticalIconsKindcircuit-compiler"]')
.click('[data-id="play-editor"]')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple.wasm"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple.wasm"]')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/bin/simple.wasm"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/bin/simple.wasm"]')
},
'Should compute a witness for a simple circuit #group1': function (browser: NightwatchBrowser) {
browser
@ -55,8 +55,8 @@ module.exports = {
.click('[data-id="compute_witness_btn"]')
.frameParent()
.clickLaunchIcon('filePanel')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple.wtn"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple.wtn"]')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/bin/simple.wtn"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/bin/simple.wtn"]')
},
'Should compile a simple circuit using compile button in circom plugin #group2': function (browser: NightwatchBrowser) {
browser
@ -70,8 +70,8 @@ module.exports = {
.click('button[data-id="compile_circuit_btn"]')
.frameParent()
.clickLaunchIcon('filePanel')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple.wasm"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple.wasm"]')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/bin/simple.wasm"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/bin/simple.wasm"]')
},
'Should run Groth16 setup and export for a simple circuit using the GUI #group2': function (browser: NightwatchBrowser) {
browser
@ -116,8 +116,8 @@ module.exports = {
return actions.keyDown(this.Keys.CONTROL).sendKeys('s')
})
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple.wasm"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple.wasm"]')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/bin/simple.wasm"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/bin/simple.wasm"]')
},
'Should display warnings for compiled circuit without pragma version #group4': function (browser: NightwatchBrowser) {
browser
@ -164,7 +164,7 @@ module.exports = {
.waitForElementNotPresent('[data-id="circuit_feedback"]')
.frameParent()
.clickLaunchIcon('filePanel')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple.wasm"]')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/bin/simple.wasm"]')
},
'Should create a new workspace using hash checker template #group5 #group6': function (browser: NightwatchBrowser) {
browser

@ -49,12 +49,12 @@ class CircomElectronPluginClient extends ElectronBasePluginClient {
// @ts-ignore
const wd = await this.call('fs', 'getWorkingDir')
// @ts-ignore
const outputDirExists = await this.call('fs', 'exists', path.normalize(extractParentFromKey(filePath) + '/.bin'))
const outputDirExists = await this.call('fs', 'exists', path.normalize(extractParentFromKey(filePath) + '/bin'))
// @ts-ignore
if (!outputDirExists) await this.call('fs', 'mkdir', path.normalize(extractParentFromKey(filePath) + '/.bin'))
if (!outputDirExists) await this.call('fs', 'mkdir', path.normalize(extractParentFromKey(filePath) + '/bin'))
filePath = path.join(wd, filePath)
const depPath = path.normalize(path.join(wd, '.deps/https/raw.githubusercontent.com/iden3/'))
const outputDir = path.normalize(extractParentFromKey(filePath) + '/.bin')
const outputDir = path.normalize(extractParentFromKey(filePath) + '/bin')
this.call('terminal' as any, 'logHtml', `Compiling ${filePath} with circom compiler (${version})`)
return await circomCli.run(`${filePath} -l ${depPath} -o ${outputDir}`, version, options)

@ -13,7 +13,7 @@ const logger = {
const ptau_final = "https://ipfs-cluster.ethdevops.io/ipfs/QmTiT4eiYz5KF7gQrDsgfCSTRv3wBPYJ4bRN1MmTRshpnW";
// @ts-ignore
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/calculate_hash.r1cs', { encoding: null });
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/bin/calculate_hash.r1cs', { encoding: null });
// @ts-ignore
const r1cs = new Uint8Array(r1csBuffer);
const zkey_0 = { type: "mem" };

@ -12,13 +12,13 @@ const logger = {
(async () => {
try {
// @ts-ignore
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/calculate_hash.r1cs', { encoding: null });
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/bin/calculate_hash.r1cs', { encoding: null });
// @ts-ignore
const r1cs = new Uint8Array(r1csBuffer);
// @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.wasm', { encoding: null });
// @ts-ignore
const wasm = new Uint8Array(wasmBuffer);

@ -8,7 +8,7 @@ const snarkjs = require('snarkjs');
const ptau_final = "https://ipfs-cluster.ethdevops.io/ipfs/QmTiT4eiYz5KF7gQrDsgfCSTRv3wBPYJ4bRN1MmTRshpnW";
// @ts-ignore
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/calculate_hash.r1cs', { encoding: null });
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/bin/calculate_hash.r1cs', { encoding: null });
// @ts-ignore
const r1cs = new Uint8Array(r1csBuffer);
const zkey_final = { type: "mem" };

@ -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.wasm', { encoding: null });
// @ts-ignore
const wasm = new Uint8Array(wasmBuffer);
const zkey_final = {

@ -13,7 +13,7 @@ const logger = {
const ptau_final = "https://ipfs-cluster.ethdevops.io/ipfs/QmTiT4eiYz5KF7gQrDsgfCSTRv3wBPYJ4bRN1MmTRshpnW";
// @ts-ignore
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/rln.r1cs', { encoding: null });
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/bin/rln.r1cs', { encoding: null });
// @ts-ignore
const r1cs = new Uint8Array(r1csBuffer);
const zkey_0 = { type: "mem" };

@ -73,13 +73,13 @@ async function prove (signals, wasm, wtns, r1cs, zkey_final, vKey) {
(async () => {
try {
// @ts-ignore
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/rln.r1cs', { encoding: null });
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/bin/rln.r1cs', { encoding: null });
// @ts-ignore
const r1cs = new Uint8Array(r1csBuffer);
// @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.wasm', { encoding: null });
// @ts-ignore
const wasm = new Uint8Array(wasmBuffer);

@ -8,7 +8,7 @@ const snarkjs = require('snarkjs');
const ptau_final = "https://ipfs-cluster.ethdevops.io/ipfs/QmciCq5JcZQyTLvC9GRanrLBi82ZmSriq1Fr5zANkGHebf";
// @ts-ignore
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/rln.r1cs', { encoding: null });
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/bin/rln.r1cs', { encoding: null });
// @ts-ignore
const r1cs = new Uint8Array(r1csBuffer);
const zkey_final = { type: "mem" };

@ -96,13 +96,13 @@ async function prove (signals, wasm, wtns, r1cs, zkey_final, vKey) {
(async () => {
try {
// @ts-ignore
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/rln.r1cs', { encoding: null });
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/bin/rln.r1cs', { encoding: null });
// @ts-ignore
const r1cs = new Uint8Array(r1csBuffer);
// @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.wasm', { encoding: null });
// @ts-ignore
const wasm = new Uint8Array(wasmBuffer);

@ -13,7 +13,7 @@ const logger = {
const ptau_final = "https://ipfs-cluster.ethdevops.io/ipfs/QmTiT4eiYz5KF7gQrDsgfCSTRv3wBPYJ4bRN1MmTRshpnW";
// @ts-ignore
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/semaphore.r1cs', { encoding: null });
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/bin/semaphore.r1cs', { encoding: null });
// @ts-ignore
const r1cs = new Uint8Array(r1csBuffer);
const zkey_0 = { type: "mem" };

@ -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', true);
// @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.wasm', true);
// @ts-ignore
const wasm = new Uint8Array(wasmBuffer);

@ -13,7 +13,7 @@ const logger = {
const ptau_final = "https://ipfs-cluster.ethdevops.io/ipfs/QmciCq5JcZQyTLvC9GRanrLBi82ZmSriq1Fr5zANkGHebf";
// @ts-ignore
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/semaphore.r1cs', { encoding: null });
const r1csBuffer = await remix.call('fileManager', 'readFile', 'circuits/bin/semaphore.r1cs', { encoding: null });
// @ts-ignore
const r1cs = new Uint8Array(r1csBuffer);
const zkey_final = { type: "mem" };

@ -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', true);
// @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.wasm', true);
// @ts-ignore
const wasm = new Uint8Array(wasmBuffer);

@ -26,7 +26,7 @@ function hash(message: any): bigint {
const ptau_final = "https://ipfs-cluster.ethdevops.io/ipfs/QmTiT4eiYz5KF7gQrDsgfCSTRv3wBPYJ4bRN1MmTRshpnW";
// @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', true);
// @ts-ignore
const r1cs = new Uint8Array(r1csBuffer);
const zkey_0 = { type: "mem" };

@ -25,11 +25,11 @@ 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', true);
// @ts-ignore
const r1cs = new Uint8Array(r1csBuffer);
// @ts-ignore
const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/.bin/semaphore.wasm', true);
const wasmBuffer = await remix.call('fileManager', 'readFile', 'circuits/bin/semaphore.wasm', true);
// @ts-ignore
const wasm = new Uint8Array(wasmBuffer);

Loading…
Cancel
Save