TaceoLabs / co-snarks

Tooling for creating collaborative SNARKs for Circom circuits.
https://docs.taceo.io
Apache License 2.0
91 stars 8 forks source link

Partial loops over components cause panic in witness extension #235

Open fabian1409 opened 1 week ago

fabian1409 commented 1 week ago

Looping over components and skipping e.g., the 0th element, causes a panic during the witness extension. Probably a bug in our compiler (there were similar issues in the past).

A minimal example that runs with snarkjs and fails with co-circom:

pragma circom 2.0.0;
include "comparators.circom";

template Main(inputs) {
    component isZero[inputs+1];
    for (var i = 1; i < inputs+1; i++) {
            isZero[i] = IsZero();
            isZero[i].in <== 1;
    }
}

component main = Main(2);

Panic:

thread panicked at ./collaborative-circom-main/co-circom/circom-mpc-vm/src/mpc_vm.rs:463:32:
range end index 9 out of range for slice of length 7

This is probably the reason why the witness extension for HinkalswapperM1x2x1 is wrong.