Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Error while binding functions which use libff::random_element() #4

Open
gargarchit opened this issue Jun 20, 2020 · 0 comments
Labels
Priority: 2 - High 😰 Should be fixed as quickly as possible, ideally within the current or following sprint Type: Bug 🐛 Some functionality not working in the codebase as intended

Comments

@gargarchit
Copy link
Member

Description

Getting Segmentation fault while binding, functions which use random_element()
random_element() is defined in Libff: a C++ library for Finite Fields and Elliptic Curves
and it returns a random element of Fp_model

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff40b7c8c in libff::Fp_model<5l, libff::mnt46_modulus_B>::random_element() ()
    at /home/PyZPK/third_party/libsnark/depends/libff/libff/algebra/fields/fp.tcc:712
712                 r.mont_repr.data[part] &= ~(1ul<<bit);
(gdb) p part
$1 = 288230376151711743
(gdb) p r.mont_repr.data
$2 = {0, 0, 0, 0, 0}

One of the functions which use libff::random_element() is generate_r1cs_example_with_field_input and it is wrapped here

Expected Behavior

The value of part should be <5 for the data array = {0, 0, 0, 0, 0}

It was tested in libsnark library directly where it was working fine without any error.

System Information

  • OS: Ubuntu
  • OS Version: 18.04
  • Language Version: Python 3.7

How to test

The following test must pass after solving this error, currently generate_r1cs_example_with_field_input is producing the error mentioned above.

import pyzpk
qap_degree = 1 << pyzpk.mnt6_Fr_s  # basic_domain_size
num_inputs = 10
num_constraints = qap_degree - num_inputs - 1
# For Field input
example = pyzpk.generate_r1cs_example_with_field_input(num_constraints, num_inputs)
assert example.constraint_system.is_satisfied(example.primary_input, example.auxiliary_input)
@gargarchit gargarchit added Priority: 2 - High 😰 Should be fixed as quickly as possible, ideally within the current or following sprint Type: Bug 🐛 Some functionality not working in the codebase as intended labels Jun 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 2 - High 😰 Should be fixed as quickly as possible, ideally within the current or following sprint Type: Bug 🐛 Some functionality not working in the codebase as intended
Projects
None yet
Development

No branches or pull requests

1 participant