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

Underflow panic #79

Open
Schaeff opened this issue Jun 22, 2021 · 3 comments
Open

Underflow panic #79

Schaeff opened this issue Jun 22, 2021 · 3 comments
Labels
D-easy Difficulty: easy P-medium Priority: medium T-bug Type: bug

Comments

@Schaeff
Copy link
Contributor

Schaeff commented Jun 22, 2021

Summary of Bug

While adding Marlin as a backend for ZoKrates, I'm hitting an underflow panic during the setup phase:

This works (1 public input: the return value):

def main(private field x) -> field:
   return x**2

This fails (1 public input: the return value):

def main(private field x) -> field:
   return x
attempt to subtract with overflow ark-marlin-0.2.0/src/ahp/mod.rs:108:28

It seems like k_size is expected to be bigger than 2, but in this case isn't.

Version

0.2.0

Steps to Reproduce

For these examples I used a universal setup degree of 5 for all parameters.

@weikengchen
Copy link
Member

We should add some assertions on that or try to support very simple statements. But basically, the problem is here: the matrices of the statement are way too simple, such that the number of nonzeros in the matrices ("k_size") is smaller than 2. This issue would not appear if one is proving statements that are more complicated.

It is separate from Marlin only supports instances where the public inputs are of size one less than a power of 2.

A quick fix is this: pads the constraint system with at least two simple constraints like a * a = a. A more formal fix is possible, but I need to examine the protocol further.

@Schaeff
Copy link
Contributor Author

Schaeff commented Jun 22, 2021

Thanks for the quick response!

This is indeed a very trivial program, it would be nice to support it if possible though, or at least have a specification of which programs are not accepted so that we can check on our side instead of crashing.

@Schaeff
Copy link
Contributor Author

Schaeff commented Jun 22, 2021

I updated my examples due to a mistake on my end. These are even simpler now.

@Pratyush Pratyush added D-easy Difficulty: easy P-medium Priority: medium T-bug Type: bug labels Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D-easy Difficulty: easy P-medium Priority: medium T-bug Type: bug
Projects
None yet
Development

No branches or pull requests

3 participants