dusk-network/plonk

Test fails when using `rng`

xevisalle opened this issue · 0 comments

Describe the bug
While implementing some required blinders in the prover, we noticed that the test append_logical_xor fails, when trying to generate a proof for the specific case // Test random works. The returned error is Polynomial Degree Too Large.

To Reproduce
Go to the prover, and add the following lines:

let b_10 = BlsScalar::random(&mut *rng);
let b_11 = BlsScalar::random(&mut *rng);
let b_12 = BlsScalar::random(&mut *rng);

Then test append_logical_xor. If you remove one of the 3 added lines, it will pass. If you go to the function blind_poly() and remove the randomness used there, it will pass too.

EDIT: We found out that the tests passes when changing the seed in

let mut rng = StdRng::seed_from_u64(0xdea1);
.

Actually, the part failing is this one:

// Test random works:

EDIT 2: The problem is in the test itself. It computes an xor operation without taking into account the modulus applied to all operations. Basically:

((a ^ b) & bit_mask) % mod != (((a ^ b) % mod) & bit_mask) % mod