Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
461 changes: 322 additions & 139 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ edition = "2021"
homepage = "https://scroll.io"
readme = "README.md"
repository = "https://github.com/scroll-tech/scroll"
version = "4.7.1"
version = "4.7.11"

[workspace.dependencies]
scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" }
scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" }
# with openvm 1.4.2
scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
Comment on lines +17 to +23
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's look at the Cargo.toml file to understand the context
cd $(git rev-parse --show-toplevel 2>/dev/null || pwd)
cat -n Cargo.toml | head -30

Repository: scroll-tech/scroll

Length of output: 1322


🏁 Script executed:

# Search for PR objectives, commit messages, or documentation mentioning OpenVM
rg -i "openvm.*1\.4\.[23]" --type-list

Repository: scroll-tech/scroll

Length of output: 451


🏁 Script executed:

# Check if there are any PR descriptions, README, or CHANGELOG files
fd -e md -e txt | grep -iE "(readme|changelog|pr|pull|objective)" | head -20

Repository: scroll-tech/scroll

Length of output: 272


🏁 Script executed:

# Look for any OpenVM version references in the entire repository
rg "openvm.*1\.4" -i

Repository: scroll-tech/scroll

Length of output: 6331


Update the OpenVM version comment from 1.4.2 to 1.4.3.

The Cargo.lock file shows OpenVM 1.4.3 is the actual dependency version, but the comment on line 20 references 1.4.2. Update the comment to reflect the correct version.

Suggested fix
-# with openvm 1.4.2
+# with openvm 1.4.3
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
version = "4.7.11"
[workspace.dependencies]
scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" }
scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.7.1" }
# with openvm 1.4.2
scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
version = "4.7.11"
[workspace.dependencies]
# with openvm 1.4.3
scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "4a78ca9" }
🤖 Prompt for AI Agents
In `@Cargo.toml` around lines 17 - 23, Update the inline comment that currently
reads "with openvm 1.4.2" to "with openvm 1.4.3" in the Cargo.toml
workspace.dependencies block so the comment matches the actual OpenVM version
recorded in Cargo.lock; locate the comment near the
scroll-zkvm-prover/scroll-zkvm-verifier/scroll-zkvm-types entries and change
only the version number in that comment.


sbv-primitives = { git = "https://github.com/scroll-tech/stateless-block-verifier", tag = "scroll-v91.2", features = ["scroll", "rkyv"] }
sbv-utils = { git = "https://github.com/scroll-tech/stateless-block-verifier", tag = "scroll-v91.2" }
Expand Down
19 changes: 2 additions & 17 deletions crates/libzkp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,8 @@ use serde_json::value::RawValue;
use std::{collections::HashMap, path::Path, sync::OnceLock};
use tasks::chunk_interpreter::{ChunkInterpreter, TryFromWithInterpreter};

pub(crate) fn witness_use_legacy_mode(fork_name: &str) -> eyre::Result<bool> {
ADDITIONAL_FEATURES
.get()
.and_then(|features| features.get(fork_name))
.map(|cfg| cfg.legacy_witness_encoding)
.ok_or_else(|| {
eyre::eyre!(
"can not find features setting for unrecognized fork {}",
fork_name
)
})
}

#[derive(Debug, Default, Clone)]
struct FeatureOptions {
legacy_witness_encoding: bool,
for_openvm_13_prover: bool,
}

Expand All @@ -41,11 +27,10 @@ impl FeatureOptions {
for feat_s in feats.split(':') {
match feat_s.trim().to_lowercase().as_str() {
"legacy_witness" => {
tracing::info!("set witness encoding for legacy mode");
ret.legacy_witness_encoding = true;
tracing::warn!("legacy witness is no longer supported");
}
"openvm_13" => {
tracing::info!("set prover should use openvm 13");
tracing::warn!("set prover should use openvm 13");
ret.for_openvm_13_prover = true;
}
s => tracing::warn!("unrecognized dynamic feature: {s}"),
Expand Down
8 changes: 3 additions & 5 deletions crates/libzkp/src/proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ use crate::utils::short_git_version;
use eyre::Result;
use sbv_primitives::B256;
use scroll_zkvm_types::{
batch::BatchInfo,
bundle::BundleInfo,
chunk::ChunkInfo,
proof::{EvmProof, OpenVmEvmProof, ProofEnum, StarkProof},
public_inputs::MultiVersionPublicInputs,
scroll::{batch::BatchInfo, bundle::BundleInfo, chunk::ChunkInfo},
types_agg::AggregationInput,
utils::{serialize_vk, vec_as_base64},
version,
Expand Down Expand Up @@ -215,7 +213,7 @@ impl<Metadata: ProofMetadata> PersistableProof for WrappedProof<Metadata> {
mod tests {
use base64::{prelude::BASE64_STANDARD, Engine};
use sbv_primitives::B256;
use scroll_zkvm_types::{bundle::BundleInfo, proof::EvmProof};
use scroll_zkvm_types::{proof::EvmProof, scroll::bundle::BundleInfo};

use super::*;

Expand Down Expand Up @@ -253,7 +251,7 @@ mod tests {
msg_queue_hash: B256::repeat_byte(6),
encryption_key: None,
};
let bundle_pi_hash = bundle_info.pi_hash_euclidv1();
let bundle_pi_hash = bundle_info.pi_hash_by_version(version::Version::euclid_v1());
BundleProofMetadata {
bundle_info,
bundle_pi_hash,
Expand Down
22 changes: 9 additions & 13 deletions crates/libzkp/src/tasks/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ use c_kzg::Bytes48;
use eyre::Result;
use sbv_primitives::{B256, U256};
use scroll_zkvm_types::{
batch::{
build_point_eval_witness, BatchHeader, BatchHeaderV6, BatchHeaderV7, BatchHeaderValidium,
BatchInfo, BatchWitness, Envelope, EnvelopeV6, EnvelopeV7, LegacyBatchWitness,
ReferenceHeader, N_BLOB_BYTES,
},
chunk::ChunkInfo,
public_inputs::{ForkName, MultiVersionPublicInputs, Version},
scroll::{
batch::{
build_point_eval_witness, BatchHeader, BatchHeaderV6, BatchHeaderV7,
BatchHeaderValidium, BatchInfo, BatchWitness, Envelope, EnvelopeV6, EnvelopeV7,
ReferenceHeader, N_BLOB_BYTES,
},
chunk::ChunkInfo,
},
task::ProvingTask,
utils::{to_rkyv_bytes, RancorError},
version::{Codec, Domain, STFVersion},
};

Expand Down Expand Up @@ -118,12 +119,7 @@ pub struct BatchProvingTask {
impl BatchProvingTask {
pub fn into_proving_task_with_precheck(self) -> Result<(ProvingTask, BatchInfo, B256)> {
let (witness, metadata, batch_pi_hash) = self.precheck()?;
let serialized_witness = if crate::witness_use_legacy_mode(&self.fork_name)? {
let legacy_witness = LegacyBatchWitness::from(witness);
to_rkyv_bytes::<RancorError>(&legacy_witness)?.into_vec()
} else {
super::encode_task_to_witness(&witness)?
};
let serialized_witness = super::encode_task_to_witness(&witness)?;

let proving_task = ProvingTask {
identifier: self.batch_header.batch_hash().to_string(),
Expand Down
10 changes: 2 additions & 8 deletions crates/libzkp/src/tasks/bundle.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use eyre::Result;
use sbv_primitives::B256;
use scroll_zkvm_types::{
bundle::{BundleInfo, BundleWitness, LegacyBundleWitness},
public_inputs::{MultiVersionPublicInputs, Version},
scroll::bundle::{BundleInfo, BundleWitness},
task::ProvingTask,
utils::{to_rkyv_bytes, RancorError},
};

use crate::proofs::BatchProof;
Expand All @@ -27,12 +26,7 @@ pub struct BundleProvingTask {
impl BundleProvingTask {
pub fn into_proving_task_with_precheck(self) -> Result<(ProvingTask, BundleInfo, B256)> {
let (witness, bundle_info, bundle_pi_hash) = self.precheck()?;
let serialized_witness = if crate::witness_use_legacy_mode(&self.fork_name)? {
let legacy = LegacyBundleWitness::from(witness);
to_rkyv_bytes::<RancorError>(&legacy)?.into_vec()
} else {
super::encode_task_to_witness(&witness)?
};
let serialized_witness = super::encode_task_to_witness(&witness)?;

let proving_task = ProvingTask {
identifier: self.identifier(),
Expand Down
10 changes: 2 additions & 8 deletions crates/libzkp/src/tasks/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ use eyre::Result;
use sbv_core::BlockWitness;
use sbv_primitives::{types::consensus::BlockHeader, B256};
use scroll_zkvm_types::{
chunk::{execute, ChunkInfo, ChunkWitness, LegacyChunkWitness, ValidiumInputs},
public_inputs::{MultiVersionPublicInputs, Version},
scroll::chunk::{execute, ChunkInfo, ChunkWitness, ValidiumInputs},
task::ProvingTask,
utils::{to_rkyv_bytes, RancorError},
};

use super::chunk_interpreter::*;
Expand Down Expand Up @@ -117,12 +116,7 @@ impl ChunkProvingTask {

pub fn into_proving_task_with_precheck(self) -> Result<(ProvingTask, ChunkInfo, B256)> {
let (witness, chunk_info, chunk_pi_hash) = self.precheck()?;
let serialized_witness = if crate::witness_use_legacy_mode(&self.fork_name)? {
let legacy_witness = LegacyChunkWitness::from(witness);
to_rkyv_bytes::<RancorError>(&legacy_witness)?.into_vec()
} else {
super::encode_task_to_witness(&witness)?
};
let serialized_witness = super::encode_task_to_witness(&witness)?;

let proving_task = ProvingTask {
identifier: self.identifier(),
Expand Down
3 changes: 2 additions & 1 deletion crates/prover-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition.workspace = true
scroll-zkvm-types.workspace = true
scroll-zkvm-prover.workspace = true
libzkp = { path = "../libzkp"}
scroll-proving-sdk = { git = "https://github.com/scroll-tech/scroll-proving-sdk.git", rev = "05648db" }
scroll-proving-sdk = { git = "https://github.com/scroll-tech/scroll-proving-sdk.git", rev = "22ad34e" }
serde.workspace = true
serde_json.workspace = true
once_cell.workspace =true
Expand All @@ -34,6 +34,7 @@ clap = { version = "4.5", features = ["derive"] }
ctor = "0.2.8"
url = { version = "2.5.4", features = ["serde",] }
serde_bytes = "0.11.15"
bincode = { version = "2.0", features = ["serde",] }

[features]
default = []
Expand Down
88 changes: 88 additions & 0 deletions crates/prover-bin/src/dumper.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
use async_trait::async_trait;
use libzkp::ProvingTaskExt;
use scroll_proving_sdk::prover::{
proving_service::{
GetVkRequest, GetVkResponse, ProveRequest, ProveResponse, QueryTaskRequest,
QueryTaskResponse, TaskStatus,
},
ProvingService,
};
use scroll_zkvm_types::ProvingTask;

#[derive(Default)]
pub struct Dumper {
#[allow(dead_code)]
pub target_path: String,
pub json_mode: bool,
Comment on lines +13 to +16
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Honor target_path when writing dump files.

dump() always writes to the current working directory, so a CLI-specified target_path is ignored. This makes the dump output location incorrect.

🐛 Proposed fix
     fn dump(&self, input_string: &str) -> eyre::Result<()> {
         let task: ProvingTaskExt = serde_json::from_str(input_string)?;
         let task = ProvingTask::from(task);
 
+        let base_dir = if self.target_path.is_empty() {
+            std::path::Path::new(".")
+        } else {
+            std::path::Path::new(&self.target_path)
+        };
+        std::fs::create_dir_all(base_dir)?;
+
         if self.json_mode {
-            let file = std::fs::File::create("input_task.json")?;
+            let file = std::fs::File::create(base_dir.join("input_task.json"))?;
             serde_json::to_writer(std::io::BufWriter::new(file), &task)?;
         } else {
             // stream-encode serialized_witness to input_task.bin using bincode 2.0
-            let input_file = std::fs::File::create("input_task.bin")?;
+            let input_file = std::fs::File::create(base_dir.join("input_task.bin"))?;
             let mut input_writer = std::io::BufWriter::new(input_file);
             bincode::encode_into_std_write(
                 &task.serialized_witness,
                 &mut input_writer,
                 bincode::config::standard(),
             )?;
 
             // stream-encode aggregated_proofs to agg_proofs.bin using bincode 2.0
-            let agg_file = std::fs::File::create("agg_proofs.bin")?;
+            let agg_file = std::fs::File::create(base_dir.join("agg_proofs.bin"))?;
             let mut agg_writer = std::io::BufWriter::new(agg_file);
             for proof in &task.aggregated_proofs {
                 let sz = bincode::serde::encode_into_std_write(
                     &proof.proofs,
                     &mut agg_writer,
                     bincode::config::standard(),
                 )?;
                 println!("written {sz} bytes for proof");
             }
         }

Also applies to: 24-39

🤖 Prompt for AI Agents
In `@crates/prover-bin/src/dumper.rs` around lines 13 - 16, The Dumper struct's
target_path is currently ignored by dump(); update the Dumper::dump (and any
related methods around lines 24-39) to use the Dumper.target_path when
creating/writing the output file: convert target_path to a Path/PathBuf, ensure
the parent directory exists (create_dir_all if needed), join the intended
filename to that path instead of using the current working directory, and
open/create the file at that joined path for writing; also preserve existing
json_mode logic and error handling when writing to the computed target path.

}

impl Dumper {
fn dump(&self, input_string: &str) -> eyre::Result<()> {
let task: ProvingTaskExt = serde_json::from_str(input_string)?;
let task = ProvingTask::from(task);

if self.json_mode {
let file = std::fs::File::create("input_task.json")?;
serde_json::to_writer(std::io::BufWriter::new(file), &task)?;
} else {
// stream-encode serialized_witness to input_task.bin using bincode 2.0
let input_file = std::fs::File::create("input_task.bin")?;
let mut input_writer = std::io::BufWriter::new(input_file);
bincode::encode_into_std_write(
&task.serialized_witness,
&mut input_writer,
bincode::config::standard(),
)?;

// stream-encode aggregated_proofs to agg_proofs.bin using bincode 2.0
let agg_file = std::fs::File::create("agg_proofs.bin")?;
let mut agg_writer = std::io::BufWriter::new(agg_file);
for proof in &task.aggregated_proofs {
let sz = bincode::serde::encode_into_std_write(
&proof.proofs,
&mut agg_writer,
bincode::config::standard(),
)?;
println!("written {sz} bytes for proof");
}
}

Ok(())
}
}

#[async_trait]
impl ProvingService for Dumper {
fn is_local(&self) -> bool {
true
}
async fn get_vks(&self, _: GetVkRequest) -> GetVkResponse {
// get vk has been deprecated in new prover with dynamic asset loading scheme
GetVkResponse {
vks: vec![],
error: None,
}
}
async fn prove(&mut self, req: ProveRequest) -> ProveResponse {
let error = if let Err(e) = self.dump(&req.input) {
Some(format!("failed to dump: {}", e))
} else {
None
};

ProveResponse {
status: TaskStatus::Failed,
error,
..Default::default()
}
}

async fn query_task(&mut self, req: QueryTaskRequest) -> QueryTaskResponse {
QueryTaskResponse {
task_id: req.task_id,
status: TaskStatus::Failed,
error: Some("dump file finished but need a fail return to exit".to_string()),
..Default::default()
}
}
}
46 changes: 45 additions & 1 deletion crates/prover-bin/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
mod dumper;
mod prover;
mod types;
mod zk_circuits_handler;

use clap::{ArgAction, Parser, Subcommand};
use clap::{ArgAction, Parser, Subcommand, ValueEnum};
use prover::{LocalProver, LocalProverConfig};
use scroll_proving_sdk::{
prover::{types::ProofType, ProverBuilder},
Expand Down Expand Up @@ -32,12 +33,35 @@ struct Args {
command: Option<Commands>,
}

#[derive(Clone, Debug, PartialEq, Eq, ValueEnum)]
enum TaskType {
Chunk,
Batch,
Bundle,
}

impl From<TaskType> for ProofType {
fn from(value: TaskType) -> Self {
match value {
TaskType::Chunk => ProofType::Chunk,
TaskType::Batch => ProofType::Batch,
TaskType::Bundle => ProofType::Bundle,
}
}
}

#[derive(Subcommand, Debug)]
enum Commands {
Handle {
/// path to save the verifier's asset
task_path: String,
},
Dump {
#[arg(long = "json", default_value = "false")]
json_mode: bool,
Comment on lines +60 to +61
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's check the file at the specified lines
head -n 70 crates/prover-bin/src/main.rs | tail -n 20

Repository: scroll-tech/scroll

Length of output: 464


🏁 Script executed:

# Let's also check the Cargo.toml to see which clap version is being used
cat crates/prover-bin/Cargo.toml | grep -A5 clap

Repository: scroll-tech/scroll

Length of output: 255


🏁 Script executed:

# Let's look at more context around lines 60-61
sed -n '50,75p' crates/prover-bin/src/main.rs

Repository: scroll-tech/scroll

Length of output: 552


🏁 Script executed:

# Let's check if there are other bool flags in the codebase and how they're defined
rg -B2 "bool," crates/prover-bin/src/main.rs | head -40

Repository: scroll-tech/scroll

Length of output: 258


🏁 Script executed:

# Let's check if ArgAction is used elsewhere in the codebase
rg "ArgAction" crates/ --type rust

Repository: scroll-tech/scroll

Length of output: 228


🏁 Script executed:

# Let's search for other #[arg] attributes to understand the pattern
rg "#\[arg\(" crates/prover-bin/src/main.rs -A1 -B1

Repository: scroll-tech/scroll

Length of output: 528


Use action = ArgAction::SetTrue for flag-style parsing of --json.

With default_value = "false", clap 4.5 expects --json true|false. Since version in the same file uses ArgAction::SetTrue for flag-style behavior, apply the same pattern here.

🔧 Suggested change
-        #[arg(long = "json", default_value = "false")]
+        #[arg(long = "json", action = ArgAction::SetTrue)]
         json_mode: bool,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[arg(long = "json", default_value = "false")]
json_mode: bool,
#[arg(long = "json", action = ArgAction::SetTrue)]
json_mode: bool,
🤖 Prompt for AI Agents
In `@crates/prover-bin/src/main.rs` around lines 60 - 61, Change the clap argument
for the json flag to use flag-style parsing by replacing the current
default_value usage with action = ArgAction::SetTrue for the json_mode field;
locate the json_mode field declaration in main.rs (the #[arg(long = "json",
default_value = "false")] json_mode: bool,) and update it to use #[arg(long =
"json", action = ArgAction::SetTrue)] json_mode: bool, and ensure ArgAction is
in scope (same pattern used by the version flag in this file).

task_type: TaskType,
task_id: String,
},
}

#[derive(Debug, serde::Deserialize)]
Expand All @@ -63,6 +87,26 @@ async fn main() -> eyre::Result<()> {
let local_prover = LocalProver::new(cfg.clone());

match args.command {
Some(Commands::Dump {
json_mode,
task_type,
task_id,
}) => {
let prover = ProverBuilder::new(
sdk_config,
dumper::Dumper {
json_mode,
..Default::default()
},
)
.build()
.await
.map_err(|e| eyre::eyre!("build prover fail: {e}"))?;

std::sync::Arc::new(prover)
.one_shot(&[task_id], task_type.into())
.await;
Comment on lines +95 to +108
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's look at the specific file and lines mentioned
head -120 crates/prover-bin/src/main.rs | tail -40

Repository: scroll-tech/scroll

Length of output: 1372


🏁 Script executed:

# Now let's find where one_shot is defined
rg "fn one_shot" --type rust -A 5

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# Let's also search for the return type more broadly
rg "one_shot" crates/prover-bin/src/main.rs -B 2 -A 10

Repository: scroll-tech/scroll

Length of output: 1455


🏁 Script executed:

# Search for one_shot method definition
fd "\.rs$" crates/ | xargs rg "fn one_shot" -B 2 -A 8

Repository: scroll-tech/scroll

Length of output: 46


🏁 Script executed:

# Also search in the prover crate
find . -name "*.rs" -type f | xargs rg "fn one_shot" -B 2 -A 8 | head -50

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# Try to find the type definition by looking for impl blocks or traits
rg "impl.*one_shot|trait.*Prover" -B 2 -A 10 | head -100

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# Check what ProverBuilder builds to understand the prover type
rg "ProverBuilder" crates/prover-bin/src/main.rs -B 5 -A 15 | head -80

Repository: scroll-tech/scroll

Length of output: 2387


🏁 Script executed:

# Let's look at the scroll_proving_sdk crate to find the one_shot definition
find . -path "*/scroll_proving_sdk/*" -name "*.rs" | head -20

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# Check for prover definitions in the prover crate
find . -path "*/prover/*" -name "*.rs" -type f | head -30

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# List the crates directory to understand the structure
ls -la crates/ | head -30

Repository: scroll-tech/scroll

Length of output: 402


🏁 Script executed:

# Search for one_shot across all rust files more broadly
rg "fn one_shot" . --type rust

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# Try to find where ProverBuilder is defined
rg "pub.*struct ProverBuilder|impl ProverBuilder" . --type rust -A 3

Repository: scroll-tech/scroll

Length of output: 44


🏁 Script executed:

# Check the Cargo.toml in prover-bin to see where ProverBuilder comes from
cat crates/prover-bin/Cargo.toml

Repository: scroll-tech/scroll

Length of output: 1152


🏁 Script executed:

# Look at the entire repository structure to find scroll_proving_sdk
find . -name "*proving*" -o -name "*prover*" | grep -E "(\.rs$|\.toml$)" | head -30

Repository: scroll-tech/scroll

Length of output: 95


🏁 Script executed:

# Search for scroll_proving_sdk in git ls-files
git ls-files | grep -E "scroll_proving_sdk|prover" | head -50

Repository: scroll-tech/scroll

Length of output: 2303


🏁 Script executed:

# Let's check the prover.rs file in prover-bin to see how one_shot is used there
cat crates/prover-bin/src/prover.rs

Repository: scroll-tech/scroll

Length of output: 12441


🏁 Script executed:

# Check imports and see if there are any type hints about one_shot
head -50 crates/prover-bin/src/main.rs

Repository: scroll-tech/scroll

Length of output: 1262


Handle one_shot failures instead of ignoring the result.

The Dump command path ignores the return value of one_shot, while the Handle command path explicitly asserts on the result (indicating a bool return). This inconsistency means dump failures silently succeed. Check the return value and propagate the error to the CLI.

🔧 Suggested change
-            std::sync::Arc::new(prover)
-                .one_shot(&[task_id], task_type.into())
-                .await;
+            let success = std::sync::Arc::new(prover)
+                .one_shot(&[task_id], task_type.into())
+                .await;
+            if !success {
+                eyre::bail!("dump failed for task_id={task_id}");
+            }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let prover = ProverBuilder::new(
sdk_config,
dumper::Dumper {
json_mode,
..Default::default()
},
)
.build()
.await
.map_err(|e| eyre::eyre!("build prover fail: {e}"))?;
std::sync::Arc::new(prover)
.one_shot(&[task_id], task_type.into())
.await;
let prover = ProverBuilder::new(
sdk_config,
dumper::Dumper {
json_mode,
..Default::default()
},
)
.build()
.await
.map_err(|e| eyre::eyre!("build prover fail: {e}"))?;
let success = std::sync::Arc::new(prover)
.one_shot(&[task_id], task_type.into())
.await;
if !success {
eyre::bail!("dump failed for task_id={task_id}");
}
🤖 Prompt for AI Agents
In `@crates/prover-bin/src/main.rs` around lines 95 - 108, The Dump command
currently calls ProverBuilder::new(...).build().await and then ignores the
boolean/result of Arc::new(prover).one_shot(&[task_id], task_type.into()).await;
modify the Dump command path to check the returned Result/bool from one_shot
(same as the Handle path does), and if it indicates failure return or propagate
an error to the CLI (e.g., map_err/eyre::eyre! or bail). Locate the call site
for one_shot in main.rs and ensure you mirror the Handle flow: inspect the
awaited value, convert it to a useful error on failure, and propagate it up
instead of discarding it.

}
Some(Commands::Handle { task_path }) => {
let file = File::open(Path::new(&task_path))?;
let reader = BufReader::new(file);
Expand Down
Loading