diff --git a/src/commands/actions/compile.ts b/src/commands/actions/compile.ts index aeffbd5..5b7d655 100644 --- a/src/commands/actions/compile.ts +++ b/src/commands/actions/compile.ts @@ -33,6 +33,7 @@ interface ICircuits { protocol?: Protocol; circuit?: string; zkey?: string; + generateSolidity?: boolean; } interface IUserConfig { solidity?: string; @@ -103,6 +104,9 @@ export const compile = async (options: any) => { if (!circuits[i].circuit) { circuits[i].circuit = `${circuits[i].name}.circom`; } + if (circuits[i].generateSolidity === undefined) { + circuits[i].generateSolidity = true; + } } } } catch (e) { @@ -282,18 +286,20 @@ export const compile = async (options: any) => { // step 5: await WrappedSnarkJs.util.generateVkey(zKeyPath.final, vKeyPath); - // step 6: - await WrappedSnarkJs.util.generateSolidityVerifier( - zKeyPath.final, - solVerifierPath - ); + if (finalConfig.circom.circuits[i].generateSolidity) { + // step 6: + await WrappedSnarkJs.util.generateSolidityVerifier( + zKeyPath.final, + solVerifierPath + ); - // step 7: - await bumpSolidityVersion( - finalConfig.solidity ? finalConfig.solidity : "^0.8.0", - circuitName, - finalConfig.circom.circuits[i].protocol as string - ); + // step 7: + await bumpSolidityVersion( + finalConfig.solidity ? finalConfig.solidity : "^0.8.0", + circuitName, + finalConfig.circom.circuits[i].protocol as string + ); + } spinner.succeed(chalk.greenBright(`${circuitName} compiled.`)); } else { log( diff --git a/templates/config/shield.config.js b/templates/config/shield.config.js index 5d9f401..be68414 100644 --- a/templates/config/shield.config.js +++ b/templates/config/shield.config.js @@ -23,6 +23,8 @@ module.exports = { input: "input.json", // // (optional) Output path for witness file, inferred from `name` if unspecified witness: "demo.json", + // (optional) Whether solidity files should be generated for this circuit, true if unspecified + generateSolidity: true }, ], },