NilFoundation / zkllvm-blueprint

Circuit components definition library for zkLLVM circuit compiler
MIT License
43 stars 17 forks source link

Check if the division by zero in int/include/nil/blueprint/components/systems/snark/plonk/flexible/colinear_checks.hpp is ok. #388

Open martun opened 5 months ago

martun commented 5 months ago

In int/include/nil/blueprint/components/systems/snark/plonk/flexible/colinear_checks.hpp we are dividing by value of "s", which is sometimes zero. I changed it to

assignment.witness(component.W(block5 + 8), start_row_index + row) = ((alpha + s ) y0 - (alpha - s) y1 ) (s == 0u ? 0u : (2 * s).inversed()); // new fake y

But I'm not sure if this was a bug, or it's ok that S is sometimes zero. Please check.