Compare commits

..

1 Commits

Author SHA1 Message Date
Ho
0a4b0c054c utility for debugging 2025-08-09 15:43:14 +09:00
6 changed files with 82 additions and 13 deletions

14
Cargo.lock generated
View File

@@ -8395,7 +8395,7 @@ dependencies = [
[[package]]
name = "scroll-zkvm-prover"
version = "0.5.0"
source = "git+https://github.com/scroll-tech/zkvm-prover?tag=0.5.4#72f9abb00f0ef7c5e46b7856d58bb86cbb332509"
source = "git+https://github.com/scroll-tech/zkvm-prover?branch=feat%2F0.5.1#8f29f60cc73495e8586338a67433a812097427c4"
dependencies = [
"alloy-primitives",
"base64 0.22.1",
@@ -8433,7 +8433,7 @@ dependencies = [
[[package]]
name = "scroll-zkvm-types"
version = "0.5.0"
source = "git+https://github.com/scroll-tech/zkvm-prover?tag=0.5.4#72f9abb00f0ef7c5e46b7856d58bb86cbb332509"
source = "git+https://github.com/scroll-tech/zkvm-prover?branch=feat%2F0.5.1#8f29f60cc73495e8586338a67433a812097427c4"
dependencies = [
"base64 0.22.1",
"bincode",
@@ -8453,7 +8453,7 @@ dependencies = [
[[package]]
name = "scroll-zkvm-types-base"
version = "0.5.0"
source = "git+https://github.com/scroll-tech/zkvm-prover?tag=0.5.4#72f9abb00f0ef7c5e46b7856d58bb86cbb332509"
source = "git+https://github.com/scroll-tech/zkvm-prover?branch=feat%2F0.5.1#8f29f60cc73495e8586338a67433a812097427c4"
dependencies = [
"alloy-primitives",
"alloy-serde 1.0.16",
@@ -8468,7 +8468,7 @@ dependencies = [
[[package]]
name = "scroll-zkvm-types-batch"
version = "0.5.0"
source = "git+https://github.com/scroll-tech/zkvm-prover?tag=0.5.4#72f9abb00f0ef7c5e46b7856d58bb86cbb332509"
source = "git+https://github.com/scroll-tech/zkvm-prover?branch=feat%2F0.5.1#8f29f60cc73495e8586338a67433a812097427c4"
dependencies = [
"alloy-primitives",
"halo2curves-axiom",
@@ -8488,7 +8488,7 @@ dependencies = [
[[package]]
name = "scroll-zkvm-types-bundle"
version = "0.5.0"
source = "git+https://github.com/scroll-tech/zkvm-prover?tag=0.5.4#72f9abb00f0ef7c5e46b7856d58bb86cbb332509"
source = "git+https://github.com/scroll-tech/zkvm-prover?branch=feat%2F0.5.1#8f29f60cc73495e8586338a67433a812097427c4"
dependencies = [
"alloy-primitives",
"itertools 0.14.0",
@@ -8501,7 +8501,7 @@ dependencies = [
[[package]]
name = "scroll-zkvm-types-chunk"
version = "0.5.0"
source = "git+https://github.com/scroll-tech/zkvm-prover?tag=0.5.4#72f9abb00f0ef7c5e46b7856d58bb86cbb332509"
source = "git+https://github.com/scroll-tech/zkvm-prover?branch=feat%2F0.5.1#8f29f60cc73495e8586338a67433a812097427c4"
dependencies = [
"alloy-primitives",
"itertools 0.14.0",
@@ -8521,7 +8521,7 @@ dependencies = [
[[package]]
name = "scroll-zkvm-verifier"
version = "0.5.0"
source = "git+https://github.com/scroll-tech/zkvm-prover?tag=0.5.4#72f9abb00f0ef7c5e46b7856d58bb86cbb332509"
source = "git+https://github.com/scroll-tech/zkvm-prover?branch=feat%2F0.5.1#8f29f60cc73495e8586338a67433a812097427c4"
dependencies = [
"bincode",
"eyre",

View File

@@ -17,9 +17,9 @@ repository = "https://github.com/scroll-tech/scroll"
version = "4.5.8"
[workspace.dependencies]
scroll-zkvm-prover-euclid = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "0.5.4", package = "scroll-zkvm-prover" }
scroll-zkvm-verifier-euclid = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "0.5.4", package = "scroll-zkvm-verifier" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "0.5.4" }
scroll-zkvm-prover-euclid = { git = "https://github.com/scroll-tech/zkvm-prover", branch = "feat/0.5.1", package = "scroll-zkvm-prover" }
scroll-zkvm-verifier-euclid = { git = "https://github.com/scroll-tech/zkvm-prover", branch = "feat/0.5.1", package = "scroll-zkvm-verifier" }
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", branch = "feat/0.5.1" }
sbv-primitives = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "chore/openvm-1.3", features = ["scroll"] }
sbv-utils = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "chore/openvm-1.3" }

1
crates/libzkp/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
testdata/*.json

View File

@@ -83,7 +83,7 @@ impl TryFrom<BundleProvingTask> for ProvingTask {
.into_iter()
.map(|w_proof| w_proof.proof.into_root_proof().expect("expect root proof"))
.collect(),
serialized_witness: vec![witness.rkyv_serialize(Some(ForkName::Feynman))?.to_vec()],
serialized_witness: vec![witness.rkyv_serialize(None)?.to_vec()],
vk: Vec::new(),
})
}

View File

@@ -3,7 +3,6 @@ use eyre::Result;
use sbv_primitives::{types::BlockWitness, B256};
use scroll_zkvm_types::{
chunk::{execute, ChunkInfo, ChunkWitness, ToArchievedWitness},
public_inputs::ForkName,
task::ProvingTask,
};
@@ -72,7 +71,7 @@ impl TryFrom<ChunkProvingTask> for ProvingTask {
identifier: value.identifier(),
fork_name: value.fork_name,
aggregated_proofs: Vec::new(),
serialized_witness: vec![witness.rkyv_serialize(Some(ForkName::Feynman))?.to_vec()],
serialized_witness: vec![witness.rkyv_serialize(None)?.to_vec()],
vk: Vec::new(),
})
}

View File

@@ -0,0 +1,69 @@
use libzkp::{gen_universal_task, tasks::chunk_interpreter::ChunkInterpreter, TaskType};
use scroll_zkvm_types::ProvingTask;
use std::{fs, path::Path};
// Global constant for testdata directory
const TESTDATA_DIR: &str = "./testdata";
// Mock interpreter for testing chunk tasks
#[derive(Clone)]
struct MockChunkInterpreter;
impl ChunkInterpreter for MockChunkInterpreter {}
#[cfg(test)]
mod tests {
use super::*;
fn test_gen_universal_task(task_file: &str, task_type: TaskType) -> eyre::Result<ProvingTask> {
// Load chunk task JSON from testdata file
let testdata_path = Path::new(TESTDATA_DIR).join(task_file);
let task_json = fs::read_to_string(&testdata_path)?;
// Parse task_json as raw JSON object and extract fork_name field
let raw_json: serde_json::Value = serde_json::from_str(&task_json)?;
let fork_name = raw_json["fork_name"]
.as_str()
.ok_or_else(|| eyre::eyre!("fork_name field not found or not a string"))?
.to_lowercase();
let mocked_vk = vec![0u8; 32]; // Mock verification key
let interpreter = Some(MockChunkInterpreter);
let (pi_hash, metadata, task) = gen_universal_task(
task_type as i32,
&task_json,
&fork_name,
&mocked_vk,
interpreter,
)?;
assert!(!pi_hash.is_zero(), "PI hash should not be zero");
assert!(!metadata.is_empty(), "Metadata should not be empty");
assert!(!task.is_empty(), "Task should not be empty");
// Dump the task content to testdata directory
let dump_path = Path::new(TESTDATA_DIR).join("dump_univ_task.json");
std::fs::write(&dump_path, &task).ok(); // Dump task content
Ok(serde_json::from_str(&task)?)
}
#[ignore = "need testing stuff"]
#[test]
fn test_gen_universal_task_chunk() {
let _ = test_gen_universal_task("chunk_proving_task.json", TaskType::Chunk).unwrap();
}
#[ignore = "need testing stuff"]
#[test]
fn test_gen_universal_task_batch() {
let _ = test_gen_universal_task("batch_proving_task.json", TaskType::Batch).unwrap();
}
#[ignore = "need testing stuff"]
#[test]
fn test_gen_universal_task_bundle() {
let _ = test_gen_universal_task("bundle_proving_task.json", TaskType::Bundle).unwrap();
}
}