Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bdf7826
rollback dep of zkvm-prover
noel2004 Nov 25, 2025
9839bf7
prover quit while proving process has panicked
noel2004 Nov 25, 2025
d262a63
Merge remote-tracking branch 'origin/develop' into feat/prover_4.7
noel2004 Nov 25, 2025
dc29c8c
Merge remote-tracking branch 'origin/develop' into feat/prover_4.7
noel2004 Nov 25, 2025
af63bc0
fix wrong configuration
noel2004 Nov 25, 2025
5c2803c
Merge remote-tracking branch 'origin/develop' into feat/prover_4.7
noel2004 Dec 3, 2025
5ae31bc
Merge remote-tracking branch 'origin/develop' into feat/prover_4.7
noel2004 Dec 3, 2025
98be0a0
Merge remote-tracking branch 'origin/develop' into feat/prover_4.7
noel2004 Dec 9, 2025
b244fa8
Merge remote-tracking branch 'origin/develop' into feat/prover_4.7
noel2004 Dec 16, 2025
e852915
update zkvm-prover
noel2004 Dec 16, 2025
b833468
add debug mode, trivial fixings
noel2004 Dec 16, 2025
930a12a
update zkvm-prover dep and openvm to 1.4.2
noel2004 Dec 16, 2025
3b174f8
add test data for mainnet galileo and prune feynman (can not be teste…
noel2004 Dec 16, 2025
74a3d7a
udpate zkvm-prover dep
noel2004 Dec 17, 2025
ede29c7
init dumper
noel2004 Dec 18, 2025
b270d96
dumper
noel2004 Dec 18, 2025
79d79ed
fix
noel2004 Dec 18, 2025
d306b38
fix
noel2004 Dec 18, 2025
03b992f
json mode
noel2004 Dec 18, 2025
492563f
Merge remote-tracking branch 'origin/develop' into feat/zkvm_prover_142
noel2004 Jan 16, 2026
6a57a2e
update dep of zkvm prover and trivial fixing
noel2004 Jan 16, 2026
8955d4f
Merge branch 'feat/zkvm_prover_143' into develop
noel2004 Feb 16, 2026
58297d3
fix e2e tool
noel2004 Feb 19, 2026
b76539b
update test env
noel2004 Feb 19, 2026
93f755c
update dep
noel2004 Feb 20, 2026
252eea9
use galileov2 for cloak test enviroment
noel2004 Feb 20, 2026
a35834d
fix make file in e2e test
noel2004 Feb 20, 2026
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.

10 changes: 5 additions & 5 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 = "b527310" }
scroll-zkvm-verifier = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "b527310" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "b527310" }
Comment on lines +20 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:

#!/bin/bash
# Fetch the Cargo.toml from zkvm-prover repo at rev b527310
curl -s "https://raw.githubusercontent.com/scroll-tech/zkvm-prover/b527310/Cargo.toml" | grep -A 2 -B 2 "openvm" | head -40

Repository: scroll-tech/scroll

Length of output: 3165


Update OpenVM version in comment.

The comment on line 20 states "with openvm 1.4.2", but the zkvm-prover dependency at rev b527310 actually uses OpenVM v1.4.3. Update the comment to reflect the correct version.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Cargo.toml` around lines 20 - 23, Update the inline comment "with openvm
1.4.2" to reflect the actual OpenVM version used by the pinned dependency rev
b527310; change the comment to "with openvm 1.4.3" near the scroll-zkvm-prover /
scroll-zkvm-verifier / scroll-zkvm-types dependency entries so the comment
matches the revision.


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 All @@ -46,7 +47,6 @@ eyre = "0.6"
once_cell = "1.20"
base64 = "0.22"


[patch.crates-io]
revm = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
revm-bytecode = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
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 +17
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:

# Find main.rs and look for Dumper initialization
find . -name "main.rs" -path "*/prover-bin/*" -type f

Repository: scroll-tech/scroll

Length of output: 93


🏁 Script executed:

# Check the dumper.rs file to see the full context
cat -n crates/prover-bin/src/dumper.rs | head -80

Repository: scroll-tech/scroll

Length of output: 3195


🏁 Script executed:

# Search for all references to target_path in the codebase
rg "target_path" --type rust -B 2 -A 2

Repository: scroll-tech/scroll

Length of output: 321


🏁 Script executed:

# Check main.rs to see how Dumper is constructed
cat -n crates/prover-bin/src/main.rs

Repository: scroll-tech/scroll

Length of output: 5268


🏁 Script executed:

# Check if target_path is ever set anywhere else in the prover-bin crate
rg -r "target_path\s*=" crates/prover-bin --type rust

Repository: scroll-tech/scroll

Length of output: 44


target_path is declared but never used — all file writes ignore the configured path

The target_path field is initialized to an empty string (default) at line 97–99 in main.rs with no CLI argument to populate it. Within dump(), all three std::fs::File::create() calls use bare filenames—lines 25, 29, and 38—so output always goes to the process CWD, completely bypassing target_path. The #[allow(dead_code)] attribute confirms the compiler sees no reads of this field.

🐛 Proposed fix — join filenames against `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);

+        let base = std::path::Path::new(&self.target_path);
+
         if self.json_mode {
-            let file = std::fs::File::create("input_task.json")?;
+            let file = std::fs::File::create(base.join("input_task.json"))?;
             serde_json::to_writer(std::io::BufWriter::new(file), &task)?;
         } else {
-            let input_file = std::fs::File::create("input_task.bin")?;
+            let input_file = std::fs::File::create(base.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(),
             )?;
+            input_writer.flush()?;

-            let agg_file = std::fs::File::create("agg_proofs.bin")?;
+            let agg_file = std::fs::File::create(base.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");
             }
+            agg_writer.flush()?;
         }

         Ok(())
     }
 }

Also add a --target-path CLI argument to the Dump command in main.rs, populate it when constructing the Dumper, and remove the #[allow(dead_code)] attribute once in use.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/prover-bin/src/dumper.rs` around lines 13 - 17, Dumper.target_path is
never used: update the Dump CLI to accept a --target-path argument, pass that
value into the Dumper constructor (instead of leaving it as the default empty
string) and then change dump() to build output file paths by joining
Dumper.target_path with the filenames (use Path/PathBuf join semantics) for the
three std::fs::File::create() calls so files are written under the configured
directory; finally remove the #[allow(dead_code)] on target_path once it is
used.


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");
}
Comment on lines +29 to +47
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

BufWriter is never explicitly flushed — final-flush errors are silently swallowed

Rust's BufWriter calls flush() on drop, but drop silently ignores any resulting Err. If the OS can't commit the remaining buffered bytes (e.g. disk full after the last encode_into_std_write succeeds), dump still returns Ok(()) while the output file is truncated. Adding explicit flush()? calls before the function returns propagates the error correctly. The diff in the comment above includes the suggested flush calls.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/prover-bin/src/dumper.rs` around lines 29 - 47, The BufWriter
instances (input_writer and agg_writer) are never explicitly flushed so any
final IO errors (e.g., disk full) are lost; after bincode::encode_into_std_write
calls finish but before the function returns from dump in dumper.rs, call
input_writer.flush()? and agg_writer.flush()? (or the underlying
File::sync_all()? if stronger guarantees are needed) and propagate errors with ?
so final-flush failures are returned instead of being silently ignored.

}

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,
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 +106 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

Return value of one_shot is silently discarded.

The Handle command (lines 122–141) assert!s on one_shot's return value to detect failures, but Dump ignores it. A failed dump will exit with success status, masking errors.

🔧 Suggested fix
-            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 task failed for task_id: {}", task_id);
+            }

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