sikoba / isekai

Isekai verifiable computation project
MIT License
46 stars 8 forks source link

"make test" problem #20

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hello,

thanks for this great project! I did compile isekai dev branch and also isekai-1.0 release successful on XUbuntu 18.04.3 but "make test" is searching in wrong directories it seems (on both versions):

crystal spec
Showing last frame. Use --error-trace for full trace.

In spec/frontend_symbol_table_spec.cr:2:1

 2 | require "../src/frontend/storage.cr"
     ^
Error: can't find file '../src/frontend/storage.cr' relative to '/home/readme/Documents/isekai-1.0/spec'
Makefile:6: recipe for target 'test' failed
make: *** [test] Error 1

I then tried to compile libsnarc library like its described in README.md, but this also fails:

/home/readme/Documents/isekai/lib/libsnarc/src/cwrapper.cpp:8:10: fatal error: util.hpp: No such file or directory
 #include "util.hpp""
          ^~~~~~~~~~
compilation terminated.
CMakeFiles/snarc.dir/build.make:158: recipe for target 'CMakeFiles/snarc.dir/src/cwrapper.cpp.o' failed
make[2]: *** [CMakeFiles/snarc.dir/src/cwrapper.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/snarc.dir/all' failed
make[1]: *** [CMakeFiles/snarc.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I also checked the other github issues and tried running command isekai --prove=proof_file r1cs_file --scheme=bctv14a

(enter) Call to r1cs_ppzksnark_generator    [             ] (1580638442.1317s x0.00 from start)
  (enter) Call to r1cs_constraint_system::swap_AB_if_beneficial [             ] (1580638442.1319s x0.00 from start)
    (enter) Estimate densities                  [             ] (1580638442.1319s x0.00 from start)
      * Non-zero A-count (estimate): 0
      * Non-zero B-count (estimate): 0
    (leave) Estimate densities                  [0.0000s x1.03] (1580638442.1319s x0.00 from start)
    Swap is not beneficial, not performing
  (leave) Call to r1cs_constraint_system::swap_AB_if_beneficial [0.0001s x0.96] (1580638442.1320s x0.00 from start)
  (enter) Call to r1cs_to_qap_instance_map_with_evaluation  [             ] (1580638442.1320s x0.00 from start)
Unhandled exception: Failed to raise an exception: END_OF_STACK
[0x55ec9b3d9526] *CallStack::print_backtrace:Int32 +118
[0x55ec9b3b1ab6] __crystal_raise +86
[0x55ec9b45cca0] *IO::FileDescriptor +256
[0x55ec9b45d823] *IO::FileDescriptor +131
[0x55ec9b45d6e1] *IO::FileDescriptor +129
[0x55ec9b3e6ac2] *String#to_s<IO::FileDescriptor>:Nil +66
[0x55ec9b45db5e] *IO::FileDescriptor +78
[0x55ec9b45e334] *Exception+ +36
[0x55ec9b45c0b9] *AtExitHandlers::run<Int32>:Int32 +441
[0x55ec9b6ad8cb] *Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32 +139
[0x55ec9b3bc4c6] main +6
[0x7fadc76c9b97] __libc_start_main +231
[0x55ec9b3b07ba] _start +42
[0x0] ???

regards,

guipublic commented 4 years ago

Thank you for your feedback, specs are using the old frontend, the llvm frontend is using Travis for unit tests. The old frontend source files were moved but indeed not updated in the specs. I have restored the path into the spec. I will look at the other issue tomorrow.

ghost commented 4 years ago

thanks for fixing that. I now can run make test and he starts computing - but still ends with an error, perhaps related to the other issue:

crystal spec
In src/backend/arithfactory.cr:15:13

 15 | def type : String
                 ^-----
Warning: this method must return Int32, which is the return type of the overridden method Isekai::Backend::RequestFactory#type(), or a subtype of it, not String

The above warning will become an error in a future Crystal version.

A total of 1 warnings were found.
(enter) Call to r1cs_gg_ppzksnark_generator [             ] (1580655431.4748s x0.00 from start)
  (enter) Call to r1cs_constraint_system::swap_AB_if_beneficial [             ] (1580655431.4749s x0.00 from start)
    (enter) Estimate densities                  [             ] (1580655431.4749s x0.00 from start)
      * Non-zero A-count (estimate): 4
      * Non-zero B-count (estimate): 4
    (leave) Estimate densities                  [0.0002s x0.34] (1580655431.4751s x0.00 from start)
    Swap is not beneficial, not performing
  (leave) Call to r1cs_constraint_system::swap_AB_if_beneficial [0.0002s x0.48] (1580655431.4751s x0.00 from start)
  (enter) Call to r1cs_to_qap_instance_map_with_evaluation  [             ] (1580655431.4753s x0.00 from start)
    (enter) Compute evaluations of A, B, C, H at t  [             ] (1580655431.4755s x0.00 from start)
    (leave) Compute evaluations of A, B, C, H at t  [0.0003s x0.85] (1580655431.4758s x0.00 from start)
  (leave) Call to r1cs_to_qap_instance_map_with_evaluation  [0.0006s x0.84] (1580655431.4759s x0.00 from start)
  * QAP number of variables: 7
  * QAP pre degree: 2
  * QAP degree: 9
  * QAP number of input variables: 6
  (enter) Compute query densities               [             ] (1580655431.4760s x0.00 from start)
  (leave) Compute query densities               [0.0000s x1.04] (1580655431.4760s x0.00 from start)
  (enter) Compute gamma_ABC for R1CS verification key   [             ] (1580655431.4763s x0.00 from start)
  (leave) Compute gamma_ABC for R1CS verification key   [0.0002s x0.17] (1580655431.4765s x0.00 from start)
  (enter) Compute L query for R1CS proving key  [             ] (1580655431.4768s x0.00 from start)
  (leave) Compute L query for R1CS proving key  [0.0002s x0.16] (1580655431.4770s x0.00 from start)
  (enter) Generating G1 MSM window table        [             ] (1580655431.4773s x0.00 from start)
    Choosing window size 3 for 18 elements
    * G1 window: 3
  (leave) Generating G1 MSM window table        [0.0018s x0.83] (1580655431.4791s x0.00 from start)
  (enter) Generating G2 MSM window table        [             ] (1580655431.4794s x0.00 from start)
    Choosing window size 1 for 3 elements
    * G2 window: 1
  (leave) Generating G2 MSM window table        [0.0025s x0.86] (1580655431.4819s x0.00 from start)
  (enter) Generate R1CS proving key             [             ] (1580655431.4822s x0.00 from start)
    (enter) Generate queries                    [             ] (1580655431.4849s x0.00 from start)
      (enter) Compute the A-query                   [             ] (1580655431.4886s x0.00 from start)
      . DONE!
      (leave) Compute the A-query                   [0.0010s x1.01] (1580655431.4896s x0.00 from start)
      (enter) Compute the B-query                   [             ] (1580655431.4896s x0.00 from start)
      Non-zero coordinate count: 3/8 (37.50%)
      (leave) Compute the B-query                   [0.0017s x1.00] (1580655431.4913s x0.00 from start)
      (enter) Compute the H-query                   [             ] (1580655431.4914s x0.00 from start)
      . DONE!
      (leave) Compute the H-query                   [0.0010s x1.00] (1580655431.4924s x0.00 from start)
      (enter) Compute the L-query                   [             ] (1580655431.4924s x0.00 from start)
      . DONE!
      (leave) Compute the L-query                   [0.0001s x1.02] (1580655431.4925s x0.00 from start)
    (leave) Generate queries                    [0.0077s x0.52] (1580655431.4926s x0.00 from start)
  (leave) Generate R1CS proving key             [0.0105s x0.62] (1580655431.4927s x0.00 from start)
  (enter) Generate R1CS verification key        [             ] (1580655431.4928s x0.00 from start)
    (enter) Call to reduced_pairing<bn128_pp>   [             ] (1580655431.4929s x0.00 from start)
      (enter) Call to pairing<bn128_pp>             [             ] (1580655431.4929s x0.00 from start)
        (enter) Call to bn128_ate_precompute_G1     [             ] (1580655431.4930s x0.00 from start)
        (leave) Call to bn128_ate_precompute_G1     [0.0001s x0.63] (1580655431.4931s x0.00 from start)
        (enter) Call to bn128_ate_precompute_G2     [             ] (1580655431.4932s x0.00 from start)
        (leave) Call to bn128_ate_precompute_G2     [0.0003s x0.89] (1580655431.4934s x0.00 from start)
        (enter) Call to miller_loop<bn128_pp>       [             ] (1580655431.4935s x0.00 from start)
        (leave) Call to miller_loop<bn128_pp>       [0.0005s x0.95] (1580655431.4940s x0.00 from start)
      (leave) Call to pairing<bn128_pp>             [0.0011s x0.78] (1580655431.4941s x0.00 from start)
      (enter) Call to bn128_final_exponentiation    [             ] (1580655431.4941s x0.00 from start)
      (leave) Call to bn128_final_exponentiation    [0.0008s x1.00] (1580655431.4949s x0.00 from start)
    (leave) Call to reduced_pairing<bn128_pp>   [0.0021s x0.86] (1580655431.4950s x0.00 from start)
    (enter) Encode gamma_ABC for R1CS verification key  [             ] (1580655431.4958s x0.00 from start)
      . DONE!
    (leave) Encode gamma_ABC for R1CS verification key  [0.0011s x1.00] (1580655431.4969s x0.00 from start)
  (leave) Generate R1CS verification key        [0.0041s x0.92] (1580655431.4969s x0.00 from start)
(leave) Call to r1cs_gg_ppzksnark_generator [0.0221s x0.69] (1580655431.4970s x0.00 from start)
* G1 elements in PK: 26
* Non-zero G1 elements in PK: 21
* G2 elements in PK: 9
* Non-zero G2 elements in PK: 4
* PK size in bits: 7583
* G1 elements in VK: 6
* G2 elements in VK: 2
* GT elements in VK: 1
* VK size in bits: 3187

================================================================================
Preprocess verification key
================================================================================

(enter) Call to r1cs_gg_ppzksnark_verifier_process_vk   [             ] (1580655431.4971s x0.00 from start)
  (enter) Call to bn128_ate_precompute_G2       [             ] (1580655431.4971s x0.00 from start)
  (leave) Call to bn128_ate_precompute_G2       [0.0002s x1.01] (1580655431.4973s x0.00 from start)
  (enter) Call to bn128_ate_precompute_G2       [             ] (1580655431.4974s x0.00 from start)
  (leave) Call to bn128_ate_precompute_G2       [0.0002s x0.92] (1580655431.4976s x0.00 from start)
(leave) Call to r1cs_gg_ppzksnark_verifier_process_vk   [0.0005s x0.91] (1580655431.4976s x0.00 from start)
.(enter) Parsing and Evaluating the circuit     [             ] (1580655431.5081s x0.00 from start)
(leave) Parsing and Evaluating the circuit  [0.0002s x1.00] (1580655431.5084s x0.00 from start)
Translating Constraints ... 
Invalid memory access (signal 11) at address 0x3e800004606
[0x563d4a937726] *CallStack::print_backtrace:Int32 +118
[0x563d4a91e0f9] __crystal_sigfault_handler +217
[0x7fcdfe378890] ???
[0x563d4ab853c6] _ZN10gadgetlib25FElem18promoteToFieldTypeENS_9FieldTypeE +38
[0x563d4ab8564f] _ZN10gadgetlib25FElemmLERKS0_ +31
[0x563d4ab85689] _ZN10gadgetlib217LinearCombinationmLERKNS_5FElemE +25
[0x563d4ab6a4a0] _ZN13CircuitReader14handleMulConstEPcS0_S0_ +560
[0x563d4ab72ba1] _ZN13CircuitReader16constructCircuitEPKc +3825
[0x563d4ab72f65] _ZN13CircuitReaderC1EPKcS1_St10shared_ptrIN10gadgetlib210ProtoboardEE +485
[0x563d4ab661f8] _ZN9R1CSUtils21GenerateFromArithFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_RN8nlohmann10basic_jsonISt3mapSt6vectorS5_blmdSaNS8_14adl_serializerEEE +280
[0x563d4ab2b75d] _ZN6Snarks11Arith2JsonlERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_S7_ +93
[0x563d4aa8176a] generateR1cs +506
[0x563d4aa60099] *LibSnark#generateR1cs<String, String, String>:Nil +73
[0x563d4a92168a] ~procProc(Nil) +58
[0x563d4aa0757b] *Spec::Example#internal_run<Time::Span, Proc(Nil)>:(Array(Spec::Result) | Nil) +251
[0x563d4aa07447] *Spec::Example#run:Nil +1143
[0x563d4aa065c9] *Spec::ExampleGroup#internal_run:Nil +137
[0x563d4aa06473] *Spec::ExampleGroup#run:Nil +419
[0x563d4a9d5d57] *Spec::RootContext#run:Nil +167
[0x563d4a91ffe5] ~procProc(Int32, (Exception | Nil), Nil) +101
[0x563d4a9b6ead] *AtExitHandlers::run<Int32>:Int32 +205
[0x563d4aa80fdb] *Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32 +139
[0x563d4a9175c6] main +6
[0x7fcdfaf90b97] __libc_start_main +231
[0x563d4a90ae5a] _start +42
[0x0] ???
Makefile:6: recipe for target 'test' failed
make: *** [test] Error 11

regards,

guipublic commented 4 years ago

The tests were not using the new implementation for generating r1cs, I have fixed this and now the tests are all passing.

guipublic commented 4 years ago

For the other issue, how did you get the r1cs_file?

ghost commented 4 years ago

all working now, that was fast :)

Finished in 700.02 milliseconds
16 examples, 0 failures, 0 errors, 0 pending

for the r1cs_file - i didnt have it! that was the problem - my fault - was just trying to add more info.

Im gonna study the examples now, thanks alot for fixing! i close the issue