HorizenLabs / marlin

A Rust library for the Marlin preprocessing zkSNARK
Apache License 2.0
12 stars 0 forks source link

Invalid indexer polynomials produced when num_constraints is a power of two #3

Closed DanieleDiBenedetto closed 3 years ago

DanieleDiBenedetto commented 3 years ago

As the title suggest, if in a circuit the number of constraints is exactly equal to a power of two, inconsistent indexer polynomials are produced. For instance:

Num constraints: 1024
a_row degree: 0
a_col degree: 1
a_val degree: 0
a_row_col degree: 1
b_row degree: 1023
b_col degree: 1
b_val degree: 1023
b_row_col degree: 1023
c_row degree: 1023
c_col degree: 1
c_val degree: 1023
c_row_col degree: 1023

This may be a porting error. Investigate and solve.

DanieleDiBenedetto commented 3 years ago

This issue is the same of https://github.com/arkworks-rs/poly-commit/issues/40, fixed by arkworks in https://github.com/arkworks-rs/poly-commit/pull/55. A similar fix has been commited also to our poly-commit in https://github.com/HorizenLabs/poly-commit/commit/3eec3f4ab5d385db1656b2bf9eb7c14e84ae8253. A unit test marlin side has been added too in 2589862ae3f8b2e2960d7530d50a5e0f6b3c4cf0.