pepper-project / pequin

A system for verifying outsourced computations, and applying SNARKs. Simplified release of the main Pepper codebase.
Other
122 stars 46 forks source link

pure_hashget example fails #39

Closed fattaneh88 closed 5 years ago

fattaneh88 commented 5 years ago

Hello,

bellow is the trace of command:

./pepper_compile_and_setup_V.sh pure_hashget pure_hashget.vkey pure_hashget.pkey

============================================ === Compiling computation to constraints ===

compile:

BUILD SUCCESSFUL Total time: 0 seconds make[1]: Leaving directory '/home/fara/Downloads/pequin-master/compiler/frontend' WARNING: --cstdarithtruncate is disabled, so type errors will warn and arithmetic is not ANSI C compliant Compiling pure_hashget.c Expanding circuit to file pure_hashget.c.ZAATAR.circuit WARNING: Compiler may allow multiple assignments to 'const' variable with type const int WARNING: Compiler may allow multiple assignments to 'const' variable with type const int WARNING: Compiler may allow multiple assignments to 'const' variable with type const int Writing constant values to pure_hashget.c.ZAATAR.spec.cons metric_compile_1_utime pure_hashget 0.73 metric_compile_1_stime pure_hashget 0.05

metric_compile_1_wires pure_hashget 1159 metric_compile_tac2_utime pure_hashget 0.00 metric_compile_tac2_stime pure_hashget 0.00

WARNING: --cstdarithtruncate is disabled, so type errors will warn and arithmetic is not ANSI C compliant metric_compile_p2_utime pure_hashget 0.28 metric_compile_p2_stime pure_hashget 0.05

metric_compile_untac2_utime pure_hashget 0.00 metric_compile_untac2_stime pure_hashget 0.00

WARNING: --cstdarithtruncate is disabled, so type errors will warn and arithmetic is not ANSI C compliant Optimizing previously compiled circuit pure_hashget.c.ZAATAR.circuit2 Using variable dependencies from profile pure_hashget.c.ZAATAR.circuit2.profile (Complete.) Expanding circuit to file pure_hashget.c.ZAATAR.circuit Writing constraints to pure_hashget.c.ZAATAR.spec_tmp metric_num_occurrences_exo_compute 0 metric_num_occurrences_ext_gadget 0 metric_num_occurrences_hashget 2 metric_num_occurrences_hashput 0 metric_num_occurrences_ramget 0 metric_num_occurrences_ramget_fast 0 metric_num_occurrences_ramput 0 metric_num_occurrences_ramput_fast 0 Cleaning up constraints, result will appear in pure_hashget.c.ZAATAR.spec metric_compile_2_utime pure_hashget 0.87 metric_compile_2_stime pure_hashget 0.09

metric_compile_2_wires pure_hashget 83 Expanding database operations in ../pure_hashget.c.ZAATAR.spec Creating prover worksheet, result will appear at bin/pure_hashget.pws Writing QAP matrices to ../../pepper/bin/pure_hashget.qap Traceback (most recent call last): File "zcc_backend.py", line 331, in main() File "zcc_backend.py", line 328, in main gen.generate_code_from_template(opt.spec) File "zcc_backend.py", line 209, in generate_code_from_template self.generate_matrices(spec_file, defs) File "zcc_backend.py", line 130, in generate_matrices (defs['NzA'], defs['NzB'], defs['NzC'], defs['num_constraints']) = zcc_parser.generate_zaatar_matrices(spec_file, shuffledIndices, qap_file_name) File "/home/fara/Downloads/pequin-master/compiler/backend/zcc_parser.py", line 1765, in generate_zaatar_matrices process_spec_section(spec_file, START_TAG + CONSTRAINTS_TAG, END_TAG + CONSTRAINTS_TAG, f) File "/home/fara/Downloads/pequin-master/compiler/backend/zcc_parser.py", line 81, in process_spec_section func(line) File "/home/fara/Downloads/pequin-master/compiler/backend/zcc_parser.py", line 1723, in f for bc in basic_constraints: File "/home/fara/Downloads/pequin-master/compiler/backend/zcc_parser.py", line 1251, in to_basic_constraints yield expand_basic_constraint(bc) File "/home/fara/Downloads/pequin-master/compiler/backend/zcc_parser.py", line 1266, in expand_basic_constraint expansion += expand_polynomial_str(tokens) File "/home/fara/Downloads/pequin-master/compiler/backend/zcc_parser.py", line 1280, in expand_polynomial_str expanded = expand_polynomial(tokens) File "/home/fara/Downloads/pequin-master/compiler/backend/zcc_parser.py", line 1294, in expand_polynomial raise Exception("expand_polynomial: Format error: " + str(tokens)) Exception: expand_polynomial: Format error: deque(['EXTERN', 'state_op_get_block_by_hash_4_ggh_64', '0']) Makefile:113: recipe for target 'bin/pure_hashget.params' failed make: *** [bin/pure_hashget.params] Error 1

========================================== ===== Running setup (key generation) =====

./pepper_compile_and_setup_V.sh: line 35: bin/pepper_verifier_pure_hashget: No such file or directory

I have the same issue with genome_snp_freq.c or tolling.c.

I also have a question, I noticed that there is not any example with float datatype. Is it possible to write a c code woth float datatype?

Thank you vey much, Fattaneh

maxhowald commented 5 years ago

Thanks for reporting this! I was able to reproduce this and it looks like this is a regression introduced by this PR: https://github.com/pepper-project/pequin/pull/20

@fleupold any ideas? Looking at the line numbers in the stack trace above and comparing to https://github.com/pepper-project/pequin/commit/27f9610a0d307711dcb1c65e8ea7e79b8c4b8766, I don't see anything that's obviously wrong or the cause of this error, but you might be more familiar with this piece of the codebase than me at this point.

maxhowald commented 5 years ago

About floats, the current release of Pequin does not support floats at all.

There is a floating point data type supported by the SFDL compiler which is used in the old release of Pepper here. You can learn more about Pepper's implementation of this data type from this paper.

If you are interested, there are some examples of SFDL programs that use floats in the main Pepper release here.

fleupold commented 5 years ago

Thanks for pointing this out. I submitted a fix.