Zokrates / ZoKrates

A toolbox for zkSNARKs on Ethereum

Home Page:https://zokrates.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compute-witness fails: Execution failed: Sum check failed

berendjan opened this issue · comments

Description

I trained a small Neural Network model in PyTorch and I'm trying to compute a witness when I get an error stating that I should open an issue.

the repo with reproduction instructions

this is my run script:

#!/bin/bash

set -e

# compiling (takes long time)
zokrates compile -i network.zok
# perform the setup phase
zokrates setup

# execute the program
zokrates compute-witness -a \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0 32941177 72549021 62352943 59215688 23529411 14117647        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0 87058824 99607843 99607843 99607843 99607843 94509804 77647060 77647060 77647060 77647060 77647060 77647060 77647060 77647060 66666668 20392157        0        0        0        0        0        0  \
       0        0        0        0        0        0 26274511 44705882 28235295 44705882 63921570 89019608 99607843 88235294 99607843 99607843 99607843 98039215 89803922 99607843 99607843 54901963        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0  6666667 25882354  5490196 26274511 26274511 26274511 23137255  8235294 92549020 99607843 41568627        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0 32549020 99215686 81960785  7058823        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  8627451 91372549 100000000 32549020        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0 50588238 99607843 93333333 17254902        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0 23137255 97647058 99607843 24313725        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0 52156865 99607843 73333334  1960784        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  3529411 80392158 97254902 22745098        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0 49411764 99607843 71372550        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0 29411765 98431372 94117647 22352941        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0  7450980 86666667 99607843 65098041        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0  1176470 79607844 99607843 85882353 13725490        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0 14901961 99607843 99607843 30196079        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0 12156862 87843137 99607843 45098039   392156        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0 52156865 99607843 99607843 20392157        0        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0 23921568 94901961 99607843 99607843 20392157        0        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0 47450980 99607843 99607843 85882353 15686275        0        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0 47450980 99607843 81176471  7058823        0        0        0        0        0        0        0        0        0        0        0        0        0        0  \
       0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  \
7

# generate a proof of computation
zokrates generate-proof
# export a solidity verifier
zokrates export-verifier
# or verify natively
zokrates verify

After compilation (on MacBook Pro 2015 Intel i5 it took roughly 90 mins.)
The setup phase was working, however when computing the witness I see the following:

time ./run.sh 
Compiling network.zok

Compiled code written to 'out'
Number of constraints: 12697691
Performing setup...
Verification key written to 'verification.key'
Proving key written to 'proving.key'
Setup completed
Computing witness...
Execution failed: Sum check failed
The default ZoKrates interpreter should not yield this error. Please open an issue.

real	62m19.883s
user	50m2.462s
sys	16m59.227s

So Sum check failed

Is there a limitation I'm hitting?
Or is something else wrong?
I'm trying to use this for a hackathon due next week, any help would be greatly appreciated!

Thanks in advance!

Environment

  • Compiler version: ZoKrates 0.8.7
  • Operating system: macOS Monterey Version 12.6.2

Steps to Reproduce

Please follow the steps in the repo here -> https://github.com/berendjan/zk-neural-network