linting fixes for remix-ws-templates

pull/4771/head
lianahus 7 months ago
parent 4fe4b7f97e
commit 811d90ae36
  1. 4
      libs/remix-ws-templates/src/script-templates/sindri/index.ts
  2. 2
      libs/remix-ws-templates/src/script-templates/sindri/run_compile.ts
  3. 2
      libs/remix-ws-templates/src/script-templates/sindri/run_prove.ts
  4. 4
      libs/remix-ws-templates/src/script-templates/sindri/utils.ts
  5. 1
      libs/remix-ws-templates/src/templates/hashchecker/scripts/groth16/groth16_zkproof.ts
  6. 2
      libs/remix-ws-templates/src/templates/semaphore/scripts/groth16/groth16_zkproof.ts
  7. 2
      libs/remix-ws-templates/src/templates/semaphore/scripts/plonk/plonk_zkproof.ts
  8. 5
      libs/remix-ws-templates/src/templates/semaphore/scripts/run_verification.ts

@ -71,12 +71,12 @@ export const sindriScripts = async (plugin: any) => {
if (a.isTemplateEntrypoint !== b.isTemplateEntrypoint) return +b.isTemplateEntrypoint - +a.isTemplateEntrypoint
return a.path.localeCompare(b.path)
})
.map(({path}) => path)[0] || './circuit.circom'
.map(({ path }) => path)[0] || './circuit.circom'
sindriManifest.circuitPath = circomCircuitPath
}
// Derive the circuit name from the workspace name.
const {name: workspaceName} = await plugin.call('filePanel', 'getCurrentWorkspace')
const { name: workspaceName } = await plugin.call('filePanel', 'getCurrentWorkspace')
sindriManifest.name =
workspaceName
.replace(/\s*-+\s*\d*$/, '')

@ -1,4 +1,4 @@
import {compile} from './utils'
import { compile } from './utils'
const main = async () => {
const circuit = await compile()

@ -1,4 +1,4 @@
import {prove} from './utils'
import { prove } from './utils'
// You must modify the input signals to include the data you're trying to generate a proof for.
const signals: {[name: string]: number | string} = {}

@ -1,5 +1,5 @@
import sindriClient from 'sindri'
import type {CircuitInfoResponse, ProofInfoResponse} from 'sindri'
import type { CircuitInfoResponse, ProofInfoResponse } from 'sindri'
sindriClient.logLevel = 'info'
@ -9,7 +9,7 @@ const authorize = async () => {
if (!apiKey) {
throw new Error('Missing API key.')
}
sindriClient.authorize({apiKey})
sindriClient.authorize({ apiKey })
} catch {
const message = 'No Sindri API key found. Please click the gear in the lower left corner to open the settings page, and add your API key under "Sindri Credentials".'
await remix.call('notification', 'toast', message)

@ -51,7 +51,6 @@ const logger = {
console.log('check')
await snarkjs.wtns.check(r1cs, wtns, logger);
console.log('prove')
const { proof, publicSignals } = await snarkjs.groth16.prove(zkey_final, wtns);

@ -50,7 +50,7 @@ function hash(message: any): bigint {
for (let k = 0; k < 2; k++) {
const identityTrapdoor = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32)))
const identityNullifier = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32)))
secrets.push({identityTrapdoor, identityNullifier})
secrets.push({ identityTrapdoor, identityNullifier })
const secret = poseidon([identityNullifier, identityTrapdoor])
const identityCommitment = poseidon([secret])

@ -50,7 +50,7 @@ function hash(message: any): bigint {
for (let k = 0; k < 2; k++) {
const identityTrapdoor = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32)))
const identityNullifier = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32)))
secrets.push({identityTrapdoor, identityNullifier})
secrets.push({ identityTrapdoor, identityNullifier })
const secret = poseidon([identityNullifier, identityTrapdoor])
const identityCommitment = poseidon([secret])

@ -47,7 +47,7 @@ function hash(message: any): bigint {
for (let k = 0; k < 2; k++) {
const identityTrapdoor = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32)))
const identityNullifier = BigInt(ethers.utils.hexlify(ethers.utils.randomBytes(32)))
secrets.push({identityTrapdoor, identityNullifier})
secrets.push({ identityTrapdoor, identityNullifier })
const secret = poseidon([identityNullifier, identityTrapdoor])
const identityCommitment = poseidon([secret])
@ -86,7 +86,6 @@ function hash(message: any): bigint {
console.log('check')
await snarkjs.wtns.check(r1cs, wtns, logger);
console.log('prove')
const { proof, publicSignals } = await snarkjs.groth16.prove(zkey_final, wtns);
@ -94,8 +93,6 @@ function hash(message: any): bigint {
console.log('zk proof validity', verified);
proof1.root.toString() === publicSignals[0] ? console.log('merkle proof valid') : console.log('merkle proof invalid')
} catch (e) {
console.error(e.message)
}

Loading…
Cancel
Save