Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
HadiEsna committed Jul 18, 2024
1 parent adb9bf6 commit aa995bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 1 addition & 8 deletions src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ impl Verifier {
inputs[0] = 1;
sum += new_equation.evaluate_over_f(inputs.to_vec(), self.f);
sum = sum % self.f;
inputs[0] = value;
if sum != previous_equation.evaluate_over_f(inputs.try_into().unwrap(), self.f) {
if sum != previous_equation.evaluate_over_f([value].try_into().unwrap(), self.f) {
println!("sum: {}", sum);
println!(
"previous: {}",
Expand All @@ -76,10 +75,4 @@ impl Verifier {
panic!("sum is not equal to the sum of the equation");
}
}
pub fn choose_random_input_and_set_value(&self, lenght: usize) -> (i128, i128) {
let mut rng = rand::thread_rng();
let random_index = rng.gen_range(0..lenght);
let random_value = rng.gen_range(0..self.f);
(random_index as i128, random_value)
}
}
6 changes: 6 additions & 0 deletions tests/proving_process_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ fn test_verify_process2() {
let equation = sum_check::equation::Equation::from_string("x1+x2+x3");
sum_check::proving_process_interactive::run_proving_process(equation, 100);
}

#[test]
fn test_verify_process3() {
let equation = sum_check::equation::Equation::from_string("2*x1^3+x1*x2+x2*x3");
sum_check::proving_process_interactive::run_proving_process(equation, 1000);
}

0 comments on commit aa995bc

Please sign in to comment.