-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Crate
ragu_circuits
Severity
low
Description
We're storing the value x^{4n - 1} in a variable called xn_minus_1 which is confusing.
See code below.
Code
#[test]
fn test_stage_object_all_multiplications() {
// Edge case: skip = 0, num = R::n() - 1, reserved = 0.
let stage = StageObject::<R>::new(0, R::n() - 1).unwrap();
let x = Fp::random(thread_rng());
let y = Fp::random(thread_rng());
let k = Fp::random(thread_rng());
let comparison = stage.clone().into_object::<R>().unwrap();
let xn_minus_1 = x.pow_vartime([(4 * R::n() - 1) as u64]);
let comparison_sxy = comparison.sxy(x, y, k) - xn_minus_1;
assert_eq!(stage.sxy(x, y, k), comparison_sxy);
}Recommendations
Rename xn_minus_1 as x_4n_minus_1 to have a name that matches the actual value stored in this variable.
#[test]
fn test_stage_object_all_multiplications() {
// Edge case: skip = 0, num = R::n() - 1, reserved = 0.
let stage = StageObject::<R>::new(0, R::n() - 1).unwrap();
let x = Fp::random(thread_rng());
let y = Fp::random(thread_rng());
let k = Fp::random(thread_rng());
let comparison = stage.clone().into_object::<R>().unwrap();
let x_4n_minus_1 = x.pow_vartime([(4 * R::n() - 1) as u64]);
let comparison_sxy = comparison.sxy(x, y, k) - x_4n_minus_1;
assert_eq!(stage.sxy(x, y, k), comparison_sxy);
}Reactions are currently unavailable