fix(zk): test failed with trivial ct equal to 0

This commit is contained in:
Nicolas Sarlin
2025-06-11 15:16:29 +02:00
committed by Nicolas Sarlin
parent 506fdfbdd1
commit 8024753be0
2 changed files with 8 additions and 4 deletions

View File

@@ -1825,7 +1825,9 @@ mod tests {
(q / t as i128) as u64
};
let trivial = rng.gen::<u64>() % effective_cleartext_t;
// If trivial is 0 the ct is not modified so the proof will be accepted
let trivial = rng.gen_range(1..effective_cleartext_t);
let trivial_pt = trivial * delta;
let c2_plus_trivial = vec![ct.c2[0].wrapping_add(trivial_pt as i64)];
@@ -1871,7 +1873,7 @@ mod tests {
ct_plus_trivial.c2.clone(),
testcase.r.clone(),
testcase.e1.clone(),
testcase.m.clone(),
m_plus_trivial,
testcase.e2.clone(),
&crs,
);

View File

@@ -3180,7 +3180,9 @@ mod tests {
(q / t as i128) as u64
};
let trivial = rng.gen::<u64>() % effective_cleartext_t;
// If trivial is 0 the ct is not modified so the proof will be accepted
let trivial = rng.gen_range(1..effective_cleartext_t);
let trivial_pt = trivial * delta;
let c2_plus_trivial = vec![ct.c2[0].wrapping_add(trivial_pt as i64)];
@@ -3226,7 +3228,7 @@ mod tests {
ct_plus_trivial.c2.clone(),
testcase.r.clone(),
testcase.e1.clone(),
testcase.m.clone(),
m_plus_trivial,
testcase.e2.clone(),
&crs,
);