Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
temaniarpit27 committed Sep 19, 2024
1 parent 709250b commit 7e29afe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
3 changes: 3 additions & 0 deletions zero/src/bin/leader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ async fn main() -> Result<()> {

let runtime = Arc::new(Runtime::from_config(&args.paladin, register()).await?);
let prover_config: ProverConfig = args.prover_config.into();
if prover_config.block_pool_size == 0 {
panic!("block-pool-size must be greater than 0");
}

// If not in test_only mode and running in emulation mode, we'll need to
// initialize the prover state here.
Expand Down
10 changes: 1 addition & 9 deletions zero/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use crate::ops;
//
// While proving a block interval, we will output proofs corresponding to block
// batches as soon as they are generated.
const DEFAULT_PARALLEL_BLOCK_PROVING_PERMIT_POOL_SIZE: usize = 16;
static PARALLEL_BLOCK_PROVING_PERMIT_POOL: Semaphore = Semaphore::const_new(0);

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -243,14 +242,7 @@ pub async fn prove(
std::result::Result<std::result::Result<u64, anyhow::Error>, anyhow::Error>,
> = JoinSet::new();

if prover_config.block_pool_size > 0 {
PARALLEL_BLOCK_PROVING_PERMIT_POOL.add_permits(prover_config.block_pool_size);
} else {
anyhow::bail!(
"block_pool_size should be greater than 0, value passed from cli is {}",
prover_config.block_pool_size
);
}
PARALLEL_BLOCK_PROVING_PERMIT_POOL.add_permits(prover_config.block_pool_size);

while let Some((block_prover_input, is_last_block)) = block_receiver.recv().await {
block_counter += 1;
Expand Down
3 changes: 2 additions & 1 deletion zero/src/prover/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ pub struct CliProverConfig {
/// generate one proof file.
#[arg(long, default_value_t = 8)]
block_batch_size: usize,
/// The maximum number of block proving tasks that can run in parallel.
/// The maximum number of block proving tasks that can run in parallel. Must
/// be greater than zero.
#[arg(long, default_value_t = 16)]
block_pool_size: usize,
}
Expand Down

0 comments on commit 7e29afe

Please sign in to comment.