Skip to content

Commit

Permalink
CentralizedTelescope/algo: Removing nb retries from prove_routine and…
Browse files Browse the repository at this point in the history
… bench
  • Loading branch information
rrtoledo committed Jan 14, 2025
1 parent b8b55ea commit 60d6ab9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/centralized_telescope/algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use blake2::{Blake2s256, Digest};
/// Calls up to setup.max_retries times the prove_index function and returns an empty
/// proof if no suitable candidate is found.
pub(super) fn prove(setup: &Setup, prover_set: &[Element]) -> Option<Proof> {
prove_routine(setup, prover_set).2
prove_routine(setup, prover_set).1
}

/// Alba's verification algorithm, returns true if the proof is
Expand Down Expand Up @@ -57,28 +57,26 @@ pub mod internal {

/// Alba's proving algorithm used for benchmarking, returning a proof if found
/// as well as the number of steps and retries done when generating it.
pub fn bench(setup: &Setup, prover_set: &[Element]) -> (u64, u64, Option<Proof>) {
pub fn bench(setup: &Setup, prover_set: &[Element]) -> (u64, Option<Proof>) {
prove_routine(setup, prover_set)
}
}

/// Prove routine that runs prove_index up to setup.max_retries times and
/// returns the number of steps, retries and if found the Proof
fn prove_routine(setup: &Setup, prover_set: &[Element]) -> (u64, u64, Option<Proof>) {
fn prove_routine(setup: &Setup, prover_set: &[Element]) -> (u64, Option<Proof>) {
let mut steps: u64 = 0;
let mut retries: u64 = 0;

// Run prove_index up to max_retries times
for retry_counter in 0..setup.max_retries {
let (dfs_calls, proof_opt) =
prove_index(setup, prover_set, retry_counter.saturating_add(1));
steps = steps.saturating_add(dfs_calls);
retries = retry_counter;
if proof_opt.is_some() {
return (steps, retry_counter, proof_opt);
return (steps, proof_opt);
}
}
(steps, retries, None)
(steps, None)
}

/// Indexed proving algorithm, returns the total number of DFS calls done
Expand Down

0 comments on commit 60d6ab9

Please sign in to comment.