Skip to content

Commit

Permalink
Fix clean leader's command (#586)
Browse files Browse the repository at this point in the history
* Fix clean command

* Clippy
  • Loading branch information
Nashtare committed Sep 4, 2024
1 parent 9126ece commit bbfc0f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions zero_bin/common/src/prover_state/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,14 @@ pub fn delete_all() -> anyhow::Result<()> {
let file_path = entry.path();

if file_path.is_file()
&& (file_path.starts_with("prover_state")
|| file_path.starts_with("verifier_state"))
&& (entry
.file_name()
.to_string_lossy()
.starts_with("prover_state")
|| entry
.file_name()
.to_string_lossy()
.starts_with("verifier_state"))
{
// Delete all circuit files.
fs::remove_file(file_path)?;
Expand Down
7 changes: 6 additions & 1 deletion zero_bin/leader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ async fn main() -> Result<()> {
}

let args = cli::Cli::parse();

if let Command::Clean = args.command {
return zero_bin_common::prover_state::persistence::delete_all();
}

let runtime = Arc::new(Runtime::from_config(&args.paladin, register()).await?);
let prover_config: ProverConfig = args.prover_config.into();

Expand All @@ -69,7 +74,6 @@ async fn main() -> Result<()> {
}

match args.command {
Command::Clean => zero_bin_common::prover_state::persistence::delete_all()?,
Command::Stdio { previous_proof } => {
let previous_proof = get_previous_proof(previous_proof)?;
stdio::stdio_main(runtime, previous_proof, Arc::new(prover_config)).await?;
Expand Down Expand Up @@ -118,6 +122,7 @@ async fn main() -> Result<()> {
)
.await?;
}
Command::Clean => unreachable!("Flushing has already been handled."),
}

Ok(())
Expand Down

0 comments on commit bbfc0f4

Please sign in to comment.