Skip to content

Mixing groth16 and plonk for the same circuit stalls compilation #77

@camden-smallwood

Description

@camden-smallwood

When compiling the same circuit using both the groth16 and plonk protocols, compilation will stall after finishing the first circuit, regardless of order. If I comment out either circuit, compilation finishes successfully, but this requires two separate runs of npx hardhat circom. I am using node.js v16.6.1, running on a mac mini M1 with macOS Ventura 13.0.1. I am using the example Multiplier2 template from the circom tutorial.

Here is my package.json file:

{
  "name": "circom-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "circomlib": "^2.0.5",
    "hardhat-circom": "^3.3.2"
  },
  "devDependencies": {
    "@nomicfoundation/hardhat-toolbox": "^2.0.0",
    "hardhat": "^2.12.5"
  }
}

Here is my hardhat.config.ts file:

import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import 'hardhat-circom';

const config: HardhatUserConfig = {
  solidity: {
    compilers: [
      {
        version: '0.6.11',
      },
      {
        version: '0.8.17',
      },
    ],
  },
  circom: {
    inputBasePath: './circuits',
    outputBasePath: './circuits/build',
    ptau: 'powersOfTau28_hez_final_18.ptau',
    circuits: [
      {
        name: 'multiplier2',
        circuit: 'multiplier2.circom',
        input: 'input/multiplier2.json',
      },
      {
        name: 'multiplier2_plonk',
        circuit: 'multiplier2.circom',
        input: 'input/multiplier2.json',
        protocol: 'plonk',
      },
    ]
  }
};

export default config;

Here is my circuits/multiplier2.circom file:

pragma circom 2.0.0;

/*This circuit template checks that c is the multiplication of a and b.*/  

template Multiplier2 () {  

   // Declaration of signals.  
   signal input a;  
   signal input b;  
   signal output c;  

   // Constraints.  
   c <== a * b;  
}

Here is my circuits/input/multiplier2.json file:

{ "a": "3", "b": "11" }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions