Skip to content

RuntimeError: unreachable #82

@PatrickAlphaC

Description

@PatrickAlphaC

I have the following circuit:

pragma circom 2.0.0; // The circom compiler version

// Simple function to square a value
function sqr(x) { 
    return x*x;
}

// The main component for the circuit
// This checks that the input (x) does indeed solve the equation
// x^2 + x + 5 = 11
// Answer: x = 2
template Quadratic () {
    // input x (private by default)
    signal input x;
    // output, the right side of the equals sign
    signal output right;

    // Square x for x^2
    var first = sqr(x);
    // x for x
    var second = x;
    // 5 for 5
    var third = 5;
    // Add them all together to get the right side of the equation
    var sum = first + second + third;
    // Assign the right side of the equation to the output signal
    // <== is an assignment + constraint
    right <== sum;
    // Constrain the right to be 11
    // === is a constraint
    right === 11;
}

// Entry point into the circuit
component main = Quadratic();

And the following code added to my hardhat config:

circom: {
        inputBasePath: "./circuits",
        ptau: "./circuits-data/powersOfTau28_hez_final_15.ptau",
        circuits: [
            {
                name: "quadratic",
            },
        ],
    },

With ./circuits-data/powersOfTau28_hez_final_15.ptau pointing to the response from: https://hermez.s3-eu-west-1.amazonaws.com/powersOfTau28_hez_final_15.ptau

However, when I run:

yarn hardhat circom --show-stack-traces

I get the following:

yarn run v1.22.19
warning package.json: No license field
$ /my-base-dir/node_modules/.bin/hardhat circom --show-stack-traces
Error in plugin hardhat-circom: Unable to compile circuit named: quadratic

HardhatPluginError: Unable to compile circuit named: quadratic
    at SimpleTaskDefinition.circomCompile [as action] (/my-base-dir/node_modules/hardhat-circom/dist/index.js:478:19)
    at async Environment._runTaskDefinition (/my-base-dir/node_modules/hardhat/src/internal/core/runtime-environment.ts:359:14)
    at async Environment.run (/my-base-dir/node_modules/hardhat/src/internal/core/runtime-environment.ts:192:14)
    at async main (/my-base-dir/node_modules/hardhat/src/internal/cli/cli.ts:323:7)

    Caused by: RuntimeError: unreachable
        at __rust_start_panic (wasm://wasm/0260c7ce:wasm-function[6241]:0x450a48)
        at rust_panic (wasm://wasm/0260c7ce:wasm-function[6224]:0x44fd3b)
        at _ZN3std9panicking20rust_panic_with_hook17hc5c73bd02fe928d4E (wasm://wasm/0260c7ce:wasm-function[6223]:0x44fd0a)
        at _ZN3std9panicking19begin_panic_handler28_$u7b$$u7b$closure$u7d$$u7d$17hcd8b0196239bb506E (wasm://wasm/0260c7ce:wasm-function[6210]:0x44efde)
        at _ZN3std10sys_common9backtrace26__rust_end_short_backtrace17h634ecf1fa70ae144E (wasm://wasm/0260c7ce:wasm-function[6209]:0x44ef0b)
        at rust_begin_unwind (wasm://wasm/0260c7ce:wasm-function[6218]:0x44f5a5)
        at _ZN4core9panicking9panic_fmt17h1024bc10a158814eE (wasm://wasm/0260c7ce:wasm-function[6349]:0x457385)
        at _ZN4core6result13unwrap_failed17h4f10a8b6d25baa65E (wasm://wasm/0260c7ce:wasm-function[6428]:0x460e59)
        at _ZN6circom16compilation_user11wat_to_wasm17h0ddccdd0eb242234E (wasm://wasm/0260c7ce:wasm-function[81]:0xf9bd)
        at _ZN6circom16compilation_user7compile17h8ec920719898ded6E (wasm://wasm/0260c7ce:wasm-function[80]:0xe6a9)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What's going on?

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