diff --git a/zero/src/bin/leader.rs b/zero/src/bin/leader.rs index abf19bde3..728f6bb0e 100644 --- a/zero/src/bin/leader.rs +++ b/zero/src/bin/leader.rs @@ -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. diff --git a/zero/src/prover.rs b/zero/src/prover.rs index 794c61878..02360e0f7 100644 --- a/zero/src/prover.rs +++ b/zero/src/prover.rs @@ -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)] @@ -243,14 +242,7 @@ pub async fn prove( std::result::Result, 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; diff --git a/zero/src/prover/cli.rs b/zero/src/prover/cli.rs index 94ca03ed4..a6cdaebf9 100644 --- a/zero/src/prover/cli.rs +++ b/zero/src/prover/cli.rs @@ -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, }