Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes to rpc and common modules #629

Merged
merged 4 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions zero_bin/common/src/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::fs::File;
use std::path::PathBuf;

use anyhow::anyhow;
use proof_gen::proof_types::GeneratedBlockProof;

pub fn generate_block_proof_file_name(directory: &Option<&str>, block_height: u64) -> PathBuf {
Expand All @@ -17,6 +18,11 @@ pub fn get_previous_proof(path: Option<PathBuf>) -> anyhow::Result<Option<Genera
let path = path.unwrap();
let file = File::open(path)?;
let des = &mut serde_json::Deserializer::from_reader(&file);
let proof: GeneratedBlockProof = serde_path_to_error::deserialize(des)?;
Ok(Some(proof))
let proof: Vec<GeneratedBlockProof> = serde_path_to_error::deserialize(des)?;
// Individual proofs are serialized as vector to match other output formats.
if proof.len() != 1 {
return Err(anyhow!("Invalid proof format, expected vector of generated block proofs with a single element."));
}

Ok(Some(proof[0].to_owned()))
}
2 changes: 0 additions & 2 deletions zero_bin/rpc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use rpc::{retry::build_http_retry_provider, RpcType};
use tracing_subscriber::{prelude::*, EnvFilter};
use url::Url;
use zero_bin_common::block_interval::BlockIntervalStream;
use zero_bin_common::pre_checks::check_previous_proof_and_checkpoint;
use zero_bin_common::provider::CachedProvider;
use zero_bin_common::version;
use zero_bin_common::{block_interval::BlockInterval, prover_state::persistence::CIRCUIT_VERSION};
Expand Down Expand Up @@ -88,7 +87,6 @@ where
let checkpoint_block_number = params
.checkpoint_block_number
.unwrap_or(params.start_block - 1);
check_previous_proof_and_checkpoint(checkpoint_block_number, &None, params.start_block)?;

let block_interval = BlockInterval::Range(params.start_block..params.end_block + 1);
let mut block_prover_inputs = Vec::new();
Expand Down
Loading