From e1def1bfaa304ffa461428ffd36eb8fbdc5e2aa9 Mon Sep 17 00:00:00 2001 From: Robin Salen <30937548+Nashtare@users.noreply.github.com> Date: Mon, 16 Sep 2024 10:52:16 -0400 Subject: [PATCH] Small fixes to `rpc` and `common` modules (#629) * fix: do not abort on witness fetching * fix: properly deserialize proofs * Remove unrelated code * Apply comment --- zero_bin/common/src/fs.rs | 10 ++++++++-- zero_bin/rpc/src/main.rs | 2 -- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/zero_bin/common/src/fs.rs b/zero_bin/common/src/fs.rs index 6d274903e..7576cf20f 100644 --- a/zero_bin/common/src/fs.rs +++ b/zero_bin/common/src/fs.rs @@ -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 { @@ -17,6 +18,11 @@ pub fn get_previous_proof(path: Option) -> anyhow::Result = 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())) } diff --git a/zero_bin/rpc/src/main.rs b/zero_bin/rpc/src/main.rs index 12594877a..308ea8cd0 100644 --- a/zero_bin/rpc/src/main.rs +++ b/zero_bin/rpc/src/main.rs @@ -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}; @@ -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();