From 2911ce0462206e5f48ca263486057ed555f5361c Mon Sep 17 00:00:00 2001 From: "xander.z" <162873981+xander42280@users.noreply.github.com> Date: Sun, 22 Sep 2024 07:52:57 +0800 Subject: [PATCH] Fix execute only result (#13) --- sdk/src/local/stark.rs | 4 +--- sdk/src/network/prover.rs | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/sdk/src/local/stark.rs b/sdk/src/local/stark.rs index ed46a109..ab33b9b2 100644 --- a/sdk/src/local/stark.rs +++ b/sdk/src/local/stark.rs @@ -17,9 +17,7 @@ pub fn prove_stark(input: &ProverInput, storedir: &str, result: &mut ProverResul state.add_input_stream(&input.private_inputstream); let (total_steps, state) = split_prog_into_segs(state, &seg_path, "", seg_size); - result - .output_stream - .copy_from_slice(&state.public_values_stream); + result.output_stream = state.public_values_stream.clone(); if input.execute_only { return; } diff --git a/sdk/src/network/prover.rs b/sdk/src/network/prover.rs index dd467ade..406c125c 100644 --- a/sdk/src/network/prover.rs +++ b/sdk/src/network/prover.rs @@ -141,17 +141,23 @@ impl Prover for NetworkProver { sleep(Duration::from_secs(30)).await; } Some(Status::Success) => { - let stark_proof = - NetworkProver::download_file(&get_status_response.stark_proof_url).await?; - let solidity_verifier = - NetworkProver::download_file(&get_status_response.solidity_verifier_url) - .await?; - let proof_result = ProverResult { + let mut proof_result = ProverResult { output_stream: get_status_response.output_stream, proof_with_public_inputs: get_status_response.proof_with_public_inputs, - stark_proof, - solidity_verifier, + stark_proof: vec![], + solidity_verifier: vec![], }; + if !get_status_response.stark_proof_url.is_empty() { + proof_result.stark_proof = + NetworkProver::download_file(&get_status_response.stark_proof_url) + .await?; + } + if !get_status_response.solidity_verifier_url.is_empty() { + proof_result.solidity_verifier = NetworkProver::download_file( + &get_status_response.solidity_verifier_url, + ) + .await?; + } return Ok(Some(proof_result)); } _ => {