Skip to content

PLONK proof generation fails with Error: Evaluations.getEvaluation() out of bounds #617

@jCabala

Description

@jCabala

I have encountered the following behaviour when running snarkjs with PLONK backend.

  • I have a circuit below:
pragma circom 2.2.3;

template main_template() {
    signal input in0;
    (in0 - 15) * (in0 - 16) === 0;
}

component main = main_template();
  • circom compilation succeeds (produces circuit.r1cs, wasm/js witness code).
  • Witness generation succeeds (witness.js.wtns produced).
  • snarkjs wtns check circuit.r1cs witness.wtns passes.
  • snarkjs plonk setup circuit.r1cs <ptau> plonk_final.zkey succeeds.
  • snarkjs plonk prove plonk_final.zkey witness.wtns proof.json public.json fails with
[ERROR] snarkJS: Error: Evaluations.getEvaluation() out of bounds
    at Evaluations.getEvaluation (/home/jcabala/.nvm/versions/node/v20.18.3/lib/node_modules/snarkjs/build/cli.cjs:8109:19)
    at computeT (/home/jcabala/.nvm/versions/node/v20.18.3/lib/node_modules/snarkjs/build/cli.cjs:8714:50)
    at async round3 (/home/jcabala/.nvm/versions/node/v20.18.3/lib/node_modules/snarkjs/build/cli.cjs:8572:9)
    at async plonk16Prove (/home/jcabala/.nvm/versions/node/v20.18.3/lib/node_modules/snarkjs/build/cli.cjs:8247:5)
    at async plonkFullProve$1 (/home/jcabala/.nvm/versions/node/v20.18.3/lib/node_modules/snarkjs/build/cli.cjs:9018:12)
    at async Object.plonkFullProve [as action] (/home/jcabala/.nvm/versions/node/v20.18.3/lib/node_modules/snarkjs/build/cli.cjs:13610:36)
    at async clProcessor (/home/jcabala/.nvm/versions/node/v20.18.3/lib/node_modules/snarkjs/build/cli.cjs:481:27)
  • snarkjs file info plonk_final.zkey shows a suspicious condition:
[*] zkey sanity info
File info for    ./origin/plonk_final.zkey

File size:       13408 bytes
File type:       zkey
Version:         undefined
Bin version:     undefined

section    #1    size: 4        offset: 0x3128
section    #2    size: 796      offset: 0x3138
section    #3 !! size: 0        offset: 0xc
                 > Section 3 size is zero. This could cause false errors in other sections.
section    #4    size: 4        offset: 0x18
section    #5    size: 4        offset: 0x28
  • Same failure occurs with snarkjs plonk fullprove ....

  • When we change the circuit to the one below (added the output):

pragma circom 2.2.3;

template main_template() {
    signal input in0;
    signal output out0;
    out0 <== 1;
    (in0 - 15) * (in0 - 16) === 0;
}

component main = main_template();
  • snarkjs plonk prove plonk_final.zkey witness.wtns proof.json public.json works, but
  • snarkjs file info plonk_final.zkey still shows the weird condition.

Here are the scripts and circuits I have been running: https://github.com/jCabala/snarkjs-plonk-issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions