Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
79ea49c
toward 1.4
lispc Jul 6, 2025
76f55f3
wip
lispc Jul 10, 2025
e69bc26
fix
lispc Jul 10, 2025
e90fe7a
fix cycle
lispc Jul 14, 2025
6d627b2
tmp
lispc Jul 14, 2025
ba409bb
Merge remote-tracking branch 'origin/master' into chore/openvm-1.4
lispc Jul 24, 2025
2aca517
building
lispc Jul 24, 2025
53392c3
built
lispc Jul 24, 2025
201e99e
clean
lispc Jul 24, 2025
25238d9
clean
lispc Jul 24, 2025
2eb9202
ready, running
lispc Jul 24, 2025
7a3ae1a
running
lispc Jul 24, 2025
30147d9
proof
lispc Jul 24, 2025
78a4620
more renaming
lispc Jul 24, 2025
98aed63
add commit.rs
lispc Jul 24, 2025
29a59e9
rudst 1.86
lispc Jul 25, 2025
4c6fe4d
batch program 60M->9M
lispc Jul 26, 2025
1c77090
fmt
lispc Aug 4, 2025
93c7d33
update
lispc Aug 4, 2025
edf85ca
update
lispc Aug 4, 2025
aefda30
Merge remote-tracking branch 'origin/master' into chore/openvm-1.4
lispc Aug 5, 2025
e05382f
fmt
lispc Aug 5, 2025
5bf70e1
build
lispc Aug 5, 2025
2cbc992
fix
lispc Aug 5, 2025
b502a19
refator some verifier codes
lispc Aug 5, 2025
f0209ae
Merge remote-tracking branch 'origin/master' into chore/openvm-1.4
lispc Aug 6, 2025
5b73fbd
build
lispc Aug 6, 2025
87a0a14
fmt
lispc Aug 6, 2025
696112c
cargo check
lispc Aug 7, 2025
0b29ccf
fix
lispc Aug 7, 2025
93143ff
fix
lispc Aug 7, 2025
5b448e1
Merge remote-tracking branch 'origin/master' into feat/bincode-2
lispc Aug 7, 2025
7485db7
x
lispc Aug 7, 2025
3556bdc
update
lispc Aug 12, 2025
d1ad01d
seems work
lispc Aug 14, 2025
1d3ad67
test
lispc Aug 14, 2025
336464b
running
lispc Aug 15, 2025
41667bd
improve testing speedup
lispc Aug 15, 2025
b9d0bef
fmt
lispc Aug 15, 2025
f714b8c
opt
lispc Aug 15, 2025
7dc9f18
xxx
lispc Aug 16, 2025
dc7b794
update
lispc Aug 18, 2025
7aa860e
Merge remote-tracking branch 'origin/master' into chore/openvm-1.4
lispc Aug 18, 2025
a22e458
merge
lispc Aug 18, 2025
4544de2
exchange code
lightsing Aug 15, 2025
a32b055
fix rebase
lightsing Aug 18, 2025
53caeb2
fmt
lightsing Aug 18, 2025
c20af71
actually Infallible
lightsing Aug 18, 2025
77f8ed0
fmt
lightsing Aug 18, 2025
53fbcba
update
lispc Aug 19, 2025
467bcf4
Merge branch 'chore/openvm-1.4' of github.com:scroll-tech/zkvm-prover…
lispc Aug 19, 2025
0d4c636
sh
lispc Aug 19, 2025
f7102e7
Merge branch 'master' into feat/exchange-code-2
lightsing Aug 19, 2025
16a73f4
upgrade
lightsing Aug 19, 2025
3516c09
update openvm guest
lispc Aug 20, 2025
2119c17
Merge remote-tracking branch 'origin/feat/bincode-2' into feat/exchan…
lispc Aug 20, 2025
d56a94d
fmt & check
lispc Aug 20, 2025
a762941
update batch program
lispc Aug 20, 2025
8727b95
Merge remote-tracking branch 'origin/master' into feat/exchange-code-2
lispc Aug 20, 2025
2b9bec0
build
lispc Aug 20, 2025
4f32af3
build
lispc Aug 20, 2025
e016150
Merge remote-tracking branch 'origin/feat/exchange-code-2' into chore…
lispc Aug 20, 2025
2f40abb
fix
lispc Aug 20, 2025
f0e2e49
print ChunkInfo
lispc Aug 20, 2025
e8faa96
fix: remove tiny-keccak (#168)
lightsing Aug 20, 2025
ba6d249
rewrite build guest
lispc Aug 20, 2025
b88291f
add verifier
lispc Aug 20, 2025
a93462f
Merge branch 'chore/openvm-1.4' of github.com:scroll-tech/zkvm-prover…
lispc Aug 20, 2025
6ad8702
clean
lispc Aug 20, 2025
9eb27f0
minor update for hints
lispc Aug 20, 2025
e1ef064
update
lispc Aug 20, 2025
5bc5bad
fix download-release.sh
lispc Aug 20, 2025
115a396
proving 0.5.2
lispc Aug 21, 2025
3f0259f
fix tx data len
lispc Aug 21, 2025
ebdf516
feat: update sbv bincode (#169)
lightsing Aug 21, 2025
50b40ef
update ref
lightsing Aug 21, 2025
c6a5885
revert chunk_exe_commit.rs
lispc Aug 21, 2025
a80efbe
Merge branch 'feat/exchange-code-2' of github.com:scroll-tech/zkvm-pr…
lispc Aug 21, 2025
5fd1077
rewrite vk in testing
lispc Aug 21, 2025
0b27782
Merge remote-tracking branch 'origin/feat/exchange-code-2' into chore…
lispc Aug 22, 2025
6055c30
clean
lispc Aug 22, 2025
d7b800f
speedup make execute
lispc Aug 22, 2025
a52c950
log time
lispc Aug 22, 2025
c24f864
Merge remote-tracking branch 'origin/master' into feat/exchange-code-2
lispc Aug 22, 2025
d184fcf
Merge branch 'feat/exchange-code-2' into chore/openvm-1.4
lispc Aug 22, 2025
e37156a
fmt
lispc Aug 22, 2025
e956781
print Mhz
lispc Aug 23, 2025
2f914b9
Merge remote-tracking branch 'origin/chore/openvm-1.4-tmp' into chore…
lispc Aug 23, 2025
d73c9d8
clean deps
lispc Aug 24, 2025
ece0683
clean deps
lispc Aug 24, 2025
99e0389
clean rkyv
lispc Aug 24, 2025
83a90a0
fix
lispc Aug 24, 2025
216a78f
Revert "clean rkyv"
lispc Aug 24, 2025
fde6900
update
lispc Aug 25, 2025
f141fd5
cleanup
lispc Aug 25, 2025
0b5e2d2
clean much old codes
lispc Aug 25, 2025
da3de4e
lint
lispc Aug 25, 2025
0d16a61
clippy
lispc Aug 25, 2025
bb64303
update sbv
lispc Aug 25, 2025
4a6edbc
0.6.0
lispc Aug 25, 2025
2bc105b
Merge branch 'feat/exchange-code-2' into chore/openvm-1.4
lispc Aug 25, 2025
eb7bffa
done
lispc Aug 25, 2025
b5ac880
docker ignore
lispc Aug 25, 2025
ed6bf2d
build
lispc Aug 25, 2025
f41a99d
add exe_commit.rs
lispc Aug 25, 2025
e1d343f
Merge remote-tracking branch 'origin/master' into feat/exchange-code-3
lispc Aug 26, 2025
7cce987
Merge branch 'feat/exchange-code-2' into chore/openvm-1.4
lispc Aug 26, 2025
7259dbc
gpu
Velaciela Aug 27, 2025
67ce889
dump json
lispc Aug 27, 2025
3cd4e0d
lazy
lispc Aug 27, 2025
811c2fd
reset
lispc Aug 27, 2025
eea7ccf
feat: add flamegraph (#173)
lightsing Aug 27, 2025
cfb2f11
Merge remote-tracking branch 'origin/master' into chore/openvm-1.4
lispc Aug 27, 2025
5e16532
fmt
lispc Aug 27, 2025
baebdbf
clean
lispc Aug 27, 2025
b3764c6
add gpu patch
lispc Aug 28, 2025
9d44668
cuda
lispc Aug 28, 2025
7d71d7a
batchWitnessLegacy
lispc Aug 28, 2025
97ff3b8
gpu patch
Velaciela Aug 28, 2025
3ea116e
fix
Velaciela Aug 28, 2025
3ac95f6
done
Velaciela Aug 28, 2025
4a40203
Merge remote-tracking branch 'origin/master' into chore/openvm-1.4
lispc Sep 1, 2025
e36a892
fmt
lispc Sep 1, 2025
d7eace1
clean
lispc Sep 1, 2025
3452895
done
lispc Sep 1, 2025
20be511
Merge remote-tracking branch 'origin/master' into chore/openvm-1.4
lispc Sep 2, 2025
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
8 changes: 2 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/circuits/batch-circuit/batch_exe_commit.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
//! Generated by crates/build-guest. DO NOT EDIT!

pub const COMMIT: [u32; 8] = [1977200712, 164000656, 1913155134, 1077030025, 605628646, 1253556162, 226927146, 637945472];
pub const COMMIT: [u32; 8] = [657967860, 338391579, 1087457998, 461028412, 1974237338, 1280854135, 1944171188, 1779194533];
2 changes: 1 addition & 1 deletion crates/circuits/bundle-circuit/bundle_exe_commit.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
//! Generated by crates/build-guest. DO NOT EDIT!

pub const COMMIT: [u32; 8] = [1734773866, 471206981, 1116518272, 39106946, 1768537985, 1996057545, 820597863, 537872345];
pub const COMMIT: [u32; 8] = [690310147, 1276634450, 1753208105, 1937432774, 721614211, 1763047938, 931414536, 1790218801];
Binary file modified crates/circuits/bundle-circuit/digest_1
Binary file not shown.
3 changes: 1 addition & 2 deletions crates/circuits/chunk-circuit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ version = "0.6.0"
bincode = { workspace = true }
scroll-zkvm-types-circuit = { workspace = true }
scroll-zkvm-types-chunk = { workspace = true }
sbv-precompile = { workspace = true }

openvm = { workspace = true, features = ["std", "getrandom-unsupported"] }
openvm-k256 = { workspace = true }
Expand All @@ -25,4 +24,4 @@ openvm-rv32im-guest= { workspace = true }

[features]
default = ["openvm"]
openvm = ["scroll-zkvm-types-chunk/openvm", "sbv-precompile/scroll-openvm"]
openvm = ["scroll-zkvm-types-chunk/openvm"]
2 changes: 1 addition & 1 deletion crates/circuits/chunk-circuit/chunk_exe_commit.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
//! Generated by crates/build-guest. DO NOT EDIT!

pub const COMMIT: [u32; 8] = [1954389790, 1028875012, 1445798022, 1249823514, 895192610, 683282762, 201633599, 421015397];
pub const COMMIT: [u32; 8] = [1966441800, 1340831655, 1437864809, 102476650, 1754583969, 453658462, 396733580, 912949452];
1 change: 1 addition & 0 deletions crates/integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ clap.workspace = true
eyre.workspace = true
rayon.workspace = true
serde.workspace = true
toml.workspace = true
vm-zstd = { workspace = true, features = ["zstd"] }

hex.workspace = true
Expand Down
10 changes: 7 additions & 3 deletions crates/integration/src/testers/batch.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use scroll_zkvm_prover::Prover;
use scroll_zkvm_types::{
batch::{BatchHeader, BatchInfo, BatchWitness, ReferenceHeader},
batch::{BatchHeader, BatchInfo, BatchWitness, BatchWitnessLegacy, ReferenceHeader},
chunk::ChunkInfo,
proof::ProofEnum,
public_inputs::ForkName,
Expand All @@ -24,7 +24,10 @@ impl PartialProvingTask for BatchWitness {
}

fn legacy_rkyv_archive(&self) -> eyre::Result<Vec<u8>> {
Ok(rkyv::to_bytes::<rkyv::rancor::Error>(self)?.to_vec())
Ok(
rkyv::to_bytes::<rkyv::rancor::Error>(&BatchWitnessLegacy::from(self.clone()))?
.to_vec(),
)
}

fn fork_name(&self) -> ForkName {
Expand All @@ -51,7 +54,7 @@ pub struct BatchTaskGenerator {
witness: Option<BatchWitness>,
chunk_generators: Vec<ChunkTaskGenerator>,
last_witness: Option<BatchWitness>,
proof: Option<ProofEnum>,
pub proof: Option<ProofEnum>,
}

impl BatchTaskGenerator {
Expand Down Expand Up @@ -87,6 +90,7 @@ impl BatchTaskGenerator {
let proof = chunk_gen.get_or_build_proof(child_prover)?;
proofs.push(proof);
}
child_prover.reset();
Ok(proofs)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/integration/src/testers/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub fn preset_chunk() -> ChunkTaskGenerator {
let block_range = match testing_hardfork() {
ForkName::EuclidV1 => 12508460u64..=12508463u64,
ForkName::EuclidV2 => 1u64..=4u64,
ForkName::Feynman => 16525000u64..=16525003u64,
ForkName::Feynman => 16525000u64..=16525019u64,
};

ChunkTaskGenerator {
Expand Down
53 changes: 46 additions & 7 deletions crates/integration/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use sbv_primitives::{
};
use scroll_zkvm_types::{
batch::{
BatchHeader, BatchHeaderV6, BatchHeaderV7, BatchInfo, BatchWitness, PointEvalWitness,
ReferenceHeader,
BatchHeader, BatchHeaderV6, BatchHeaderV7, BatchInfo, BatchWitness, Bytes48,
PointEvalWitness, PointEvalWitnessHints, ReferenceHeader,
},
bundle::{BundleInfo, BundleWitness},
chunk::{ChunkInfo, ChunkWitness},
Expand Down Expand Up @@ -206,7 +206,7 @@ pub fn build_batch_witnesses(
let kzg_commitment = point_eval::blob_to_kzg_commitment(&kzg_blob);
let blob_versioned_hash = point_eval::get_versioned_hash(&kzg_commitment);

// primage = keccak(payload) + blob_versioned_hash
// preimage = keccak(payload) + blob_versioned_hash
let challenge_preimage = if testing_hardfork() >= ForkName::EuclidV2 {
let mut challenge_preimage = keccak256(&blob_bytes).to_vec();
challenge_preimage.extend(blob_versioned_hash.0);
Expand Down Expand Up @@ -314,19 +314,58 @@ pub fn build_batch_witnesses(
})
.collect::<Vec<_>>();

let (point_eval_witness, point_eval_witness_hints) = build_point_eval_witness(
*kzg_commitment.to_bytes().as_ref(),
*kzg_proof.to_bytes().as_ref(),
);
Ok(BatchWitness {
chunk_proofs,
chunk_infos,
reference_header,
blob_bytes,
point_eval_witness: PointEvalWitness {
kzg_commitment: *kzg_commitment.to_bytes().as_ref(),
kzg_proof: *kzg_proof.to_bytes().as_ref(),
},
point_eval_witness,
point_eval_witness_hints,
fork_name,
})
}

// TODO: move it to some correct place

fn build_point_eval_witness(
kzg_commitment: Bytes48,
kzg_proof: Bytes48,
) -> (PointEvalWitness, PointEvalWitnessHints) {
use snark_verifier_sdk::snark_verifier::halo2_base::halo2_proofs::halo2curves::bls12_381;
let commitment_point = bls12_381::G1Affine::from_compressed_be(&kzg_commitment).unwrap();
let mut kzg_commitment_hint_x = [0u8; 48];
let mut kzg_commitment_hint_y = [0u8; 48];
kzg_commitment_hint_x.copy_from_slice(&commitment_point.x.to_bytes_be());
kzg_commitment_hint_y.copy_from_slice(&commitment_point.y.to_bytes_be());
//[commitment_point_i.x().to_be_bytes(), commitment_point_i.y().to_be_bytes()].concat().try_into().unwrap();
//let commitment_point_i: G1Affine = commitment_point.convert();
//assert_eq!(kzg_commitment_hint.to_vec(), [commitment_point_i.x().to_be_bytes(), commitment_point_i.y().to_be_bytes()].concat());
println!("commitment encoded {:?}", kzg_commitment);
println!("commitment raw x {:?}", commitment_point.x.to_bytes_be());

let proof_point = bls12_381::G1Affine::from_compressed_be(&kzg_proof).unwrap();
let mut kzg_proof_hint_x = [0u8; 48];
let mut kzg_proof_hint_y = [0u8; 48];
kzg_proof_hint_x.copy_from_slice(&proof_point.x.to_bytes_be());
kzg_proof_hint_y.copy_from_slice(&proof_point.y.to_bytes_be());
(
PointEvalWitness {
kzg_commitment,
kzg_proof,
},
PointEvalWitnessHints {
kzg_commitment_hint_x,
kzg_commitment_hint_y,
kzg_proof_hint_x,
kzg_proof_hint_y,
},
)
}

#[test]
fn test_build_and_parse_batch_task() -> eyre::Result<()> {
use crate::testers::chunk::ChunkTaskGenerator;
Expand Down
31 changes: 30 additions & 1 deletion crates/prover/src/prover/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{
path::PathBuf,
str::FromStr,
sync::{Arc, OnceLock},
};

Expand All @@ -22,7 +23,6 @@ use crate::setup::read_app_exe;
use crate::{Error, setup::read_app_config, task::ProvingTask};

use scroll_zkvm_types::proof::{EvmProof, ProofEnum, StarkProof, StarkProofStat};

/// Generic prover.
pub struct Prover {
/// Prover name
Expand Down Expand Up @@ -101,6 +101,7 @@ impl Prover {
}
Ok(self.prover.get_mut().unwrap())
}

/// Pick up loaded app commit, to distinguish from which circuit the proof comes
pub fn get_app_commitment(&mut self) -> ProgramCommitment {
let prover = self.get_prover_mut().expect("Failed to initialize prover");
Expand Down Expand Up @@ -180,12 +181,40 @@ impl Prover {
.map(|res| res.total_cycle)
}

/*

*/
/// Generate a [root proof][root_proof].
///
/// [root_proof][openvm_sdk::verifier::root::types::RootVmVerifierInput]
pub fn gen_proof_stark(&mut self, stdin: StdIn) -> Result<StarkProof, Error> {
// Here we always do an execution of the guest program to get the cycle count.
// and do precheck before proving like ensure PI != 0
if true {
// dump stdin to file
let mut json: serde_json::Value = serde_json::from_str("{\"input\":[]}").unwrap();
let json_input = json["input"].as_array_mut().unwrap();
for item in &stdin.buffer {
use openvm_stark_sdk::openvm_stark_backend::p3_field::PrimeField32;
let mut bytes: Vec<u8> = vec![0x02];
for f in item {
let u32_bytes = f.as_canonical_u32().to_le_bytes();
bytes.extend_from_slice(&u32_bytes);
}
json_input.push(serde_json::Value::String(format!(
"0x{}",
hex::encode(bytes)
)));
}
// write the `json` to ${self.name}.json
let filename = format!("{}.json", self.prover_name);
if let Err(e) = std::fs::write(&filename, serde_json::to_string_pretty(&json).unwrap())
{
tracing::warn!("Failed to write stdin to {}: {}", filename, e);
} else {
tracing::info!("Wrote stdin to {}", filename);
}
}
let t = std::time::Instant::now();
let total_cycles = self.execute_and_check(&stdin)?;
let execution_time_mills = t.elapsed().as_millis() as u64;
Expand Down
27 changes: 27 additions & 0 deletions crates/types/base/src/public_inputs/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,33 @@ pub struct ChunkInfo {
#[rkyv()]
pub block_ctxs: Vec<BlockContextV2>,
}
impl std::fmt::Display for ChunkInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// Create a wrapper struct that implements Debug
struct DisplayWrapper<'a>(&'a ChunkInfo);

impl<'a> std::fmt::Debug for DisplayWrapper<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("ChunkInfo")
.field("chain_id", &self.0.chain_id)
.field("prev_state_root", &self.0.prev_state_root)
.field("post_state_root", &self.0.post_state_root)
.field("withdraw_root", &self.0.withdraw_root)
.field("data_hash", &self.0.data_hash)
.field("tx_data_digest", &self.0.tx_data_digest)
.field("prev_msg_queue_hash", &self.0.prev_msg_queue_hash)
.field("post_msg_queue_hash", &self.0.post_msg_queue_hash)
.field("tx_data_length", &self.0.tx_data_length)
.field("initial_block_number", &self.0.initial_block_number)
.field("block_ctxs", &"<omitted>")
.finish()
}
}

// Use the Debug implementation with pretty formatting
write!(f, "{:#?}", DisplayWrapper(self))
}
}

impl ChunkInfo {
/// Public input hash for a given chunk (euclidv1 or da-codec@v6) is defined as
Expand Down
3 changes: 1 addition & 2 deletions crates/types/batch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ version.workspace = true

[dependencies]
alloy-primitives = { workspace = true }
bincode = { workspace = true }
rkyv.workspace = true
serde.workspace = true
itertools.workspace = true
vm-zstd = { workspace = true }

types-base = { path = "../base", package = "scroll-zkvm-types-base" }
openvm = { workspace = true, features = ["std"] }
openvm-algebra-guest = { workspace = true }
openvm-ecc-guest = { workspace = true, features = ["halo2curves"] }
openvm-pairing-guest = { workspace = true, features = ["halo2curves"] }
openvm-pairing = { workspace = true, features = ["bls12_381", "halo2curves"] }
openvm-sha2.workspace = true
openvm-sha256-guest.workspace = true
halo2curves-axiom = "0.7.0"

[features]
Expand Down
4 changes: 3 additions & 1 deletion crates/types/batch/src/blob_consistency/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ use openvm_pairing::bls12_381::Scalar;

mod constants;
mod openvm;
mod types;
pub use openvm::point_evaluation;
pub use types::{ToIntrinsic, from_intrinsic_g1};

pub use openvm::{ToIntrinsic, kzg_to_versioned_hash, verify_kzg_proof};
pub use openvm::{kzg_to_versioned_hash, verify_kzg_proof};

// Number of bytes in a u256.
pub const N_BYTES_U256: usize = 32;
Expand Down
Loading