Skip to content

Commit b833468

Browse files
committed
add debug mode, trivial fixings
1 parent e852915 commit b833468

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

crates/prover-bin/src/prover.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ pub struct AssetsLocationData {
3030
#[serde(default)]
3131
/// a altered url for specififed vk
3232
pub asset_detours: HashMap<String, url::Url>,
33+
/// when asset file existed, do not verify from network, help for debugging stuffs
34+
#[serde(default)]
35+
pub debug_mode: bool,
3336
}
3437

3538
impl AssetsLocationData {
@@ -79,6 +82,13 @@ impl AssetsLocationData {
7982
// Get file metadata to check size
8083
if let Ok(metadata) = std::fs::metadata(&local_file_path) {
8184
// Make a HEAD request to get remote file size
85+
if self.debug_mode {
86+
println!(
87+
"File {} already exists, skipping download under debugmode",
88+
filename
89+
);
90+
continue;
91+
}
8292

8393
if let Ok(head_resp) = client.head(download_url.clone()).send().await {
8494
if let Some(content_length) = head_resp.headers().get("content-length") {
@@ -203,15 +213,15 @@ impl ProvingService for LocalProver {
203213
},
204214
Err(e) => {
205215
if e.is_panic() {
206-
// simply re-throw panic for any panicking in proving prrocess,
216+
// simply re-throw panic for any panicking in proving process,
207217
// cause worker loop and the whole prover exit
208218
std::panic::resume_unwind(e.into_panic());
209219
}
210220

211221
QueryTaskResponse {
212222
task_id: req.task_id,
213223
status: TaskStatus::Failed,
214-
error: Some(format!("proving task panicked: {}", e)),
224+
error: Some(format!("proving task failed: {}", e)),
215225
..Default::default()
216226
}
217227
}

0 commit comments

Comments
 (0)