Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
1f276d6
replace dot product
darth-cy Jan 28, 2026
747ff52
correct calculation
darth-cy Jan 28, 2026
3a94248
remove debug flags
darth-cy Jan 28, 2026
0b1fa20
remove debug flags
darth-cy Jan 28, 2026
3fecc84
organize
darth-cy Jan 28, 2026
26e4c8c
organize input ctx assignment
darth-cy Jan 28, 2026
8d74da9
flatten out evals
darth-cy Jan 29, 2026
2c3b2c9
organize
darth-cy Jan 29, 2026
81aac06
organize
darth-cy Jan 29, 2026
d466047
debug
darth-cy Feb 2, 2026
2412570
read hintz'
darth-cy Feb 2, 2026
88fc8ec
add debug flags
darth-cy Feb 2, 2026
fb40e22
debug
darth-cy Feb 2, 2026
cab31a3
remove debug flags
darth-cy Feb 2, 2026
b01b84e
remove debug flags
darth-cy Feb 2, 2026
8852523
restore cargo
darth-cy Feb 2, 2026
b482580
Merge branch 'master' into feat/sum_replace
darth-cy Feb 2, 2026
df9a84f
clean [skip ci]
darth-cy Feb 2, 2026
21d92b2
clean
darth-cy Feb 2, 2026
d80ee0c
update openvm
darth-cy Feb 2, 2026
5706ed8
adjust debug flags
darth-cy Feb 8, 2026
4a6c237
adjust debug flags
darth-cy Feb 8, 2026
81d1e35
put sumcheck hint ids on register
darth-cy Feb 8, 2026
add986e
restore openvm
darth-cy Feb 9, 2026
8aa65f5
remove debug flags
darth-cy Feb 9, 2026
7ed4ae7
fmt
darth-cy Feb 9, 2026
0798c5e
restore unit tests
darth-cy Feb 9, 2026
122bceb
update openvm
darth-cy Feb 9, 2026
1c87f71
update openvm
kunxian-xia Feb 10, 2026
336f032
remove redundant code
darth-cy Feb 11, 2026
8b8f11d
remove redundant logic
darth-cy Feb 12, 2026
60aab53
Merge branch 'master' into debug/binding
darth-cy Feb 12, 2026
220c9f8
adjust program
darth-cy Feb 12, 2026
a7fcc18
adjust program
darth-cy Feb 12, 2026
4065291
adjust program
darth-cy Feb 13, 2026
c5aae5d
adjust dependency
darth-cy Feb 13, 2026
f07379f
restore program
darth-cy Feb 13, 2026
419fb3f
fmt
darth-cy Feb 13, 2026
0f7b910
optional writeback
darth-cy Feb 23, 2026
0952441
recover logic
darth-cy Feb 24, 2026
bf797d4
recover logic
darth-cy Feb 24, 2026
6db4ec1
update cargo
darth-cy Feb 24, 2026
cffd16c
cleanup
darth-cy Feb 24, 2026
752d670
update cargo
darth-cy Feb 26, 2026
a651c3e
Merge branch 'master' into feat/sum_replace
hero78119 Feb 26, 2026
ff6bcdd
adjust program
darth-cy Feb 26, 2026
706bc16
openvm dep branch
hero78119 Feb 27, 2026
c900a62
Merge branch 'master' into feat/sum_replace
hero78119 Mar 4, 2026
dd88f30
progress
darth-cy Mar 8, 2026
a1362eb
program logic
darth-cy Mar 9, 2026
ddca0fb
dependency
darth-cy Mar 9, 2026
ca57099
adjust test
darth-cy Mar 9, 2026
1f11afa
Merge pull request #1264 from scroll-tech/feat/hint_bridge
darth-cy Mar 9, 2026
fa79e9c
vm air heights
darth-cy Mar 9, 2026
1eda056
fix internal
darth-cy Mar 9, 2026
19bea32
update dependency
darth-cy Mar 10, 2026
58b3942
update dependency
darth-cy Mar 10, 2026
b5330dc
update dependency
darth-cy Mar 10, 2026
1d47ef7
update dependency
darth-cy Mar 10, 2026
47a6d24
update dependencies
darth-cy Mar 10, 2026
d4279f9
update dependencies
darth-cy Mar 12, 2026
0628de4
update dependencies
darth-cy Mar 13, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ docs/book
# ceno serialized files
*.bin
*.json
*.srs
94 changes: 47 additions & 47 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ ceno_gpu = { git = "https://github.com/scroll-tech/ceno-gpu-mock.git", package =
cudarc = { version = "0.17.3", features = ["driver", "cuda-version-from-build-system"] }

# ceno-recursion dependencies
openvm = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
openvm-circuit = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
openvm-continuations = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
openvm-instructions = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
openvm-native-circuit = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
openvm-native-compiler = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
openvm-native-compiler-derive = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
openvm-native-recursion = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
openvm-rv32im-circuit = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
openvm-sdk = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
openvm = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/hint_bridge", default-features = false }
openvm-circuit = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/hint_bridge", default-features = false }
openvm-continuations = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/hint_bridge", default-features = false }
openvm-instructions = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/hint_bridge", default-features = false }
openvm-native-circuit = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/hint_bridge", default-features = false }
openvm-native-compiler = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/hint_bridge", default-features = false }
openvm-native-compiler-derive = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/hint_bridge", default-features = false }
openvm-native-recursion = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/hint_bridge", default-features = false }
openvm-rv32im-circuit = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/hint_bridge", default-features = false }
openvm-sdk = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/hint_bridge", default-features = false }

openvm-cuda-backend = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1", default-features = false }
openvm-stark-backend = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1", default-features = false }
Expand Down
2 changes: 0 additions & 2 deletions ceno_recursion/src/aggregation/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ impl<C: Config> NonLeafVerifierVariables<C> {
let proof = builder.get(proofs, i);
assert_required_air_for_agg_vm_present(builder, &proof);
let proof_vm_pvs = self.verify_internal_or_leaf_verifier_proof(builder, &proof);

assert_single_segment_vm_exit_successfully(builder, &proof);

builder.if_eq(i, RVar::zero()).then_or_else(
|builder| {
builder.assign(&pvs.app_commit, proof_vm_pvs.vm_verifier_pvs.app_commit);
Expand Down
85 changes: 71 additions & 14 deletions ceno_recursion/src/aggregation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ pub const INTERNAL_LOG_BLOWUP: usize = 2;
pub const ROOT_LOG_BLOWUP: usize = 3;
pub const SBOX_SIZE: usize = 7;
const VM_MAX_TRACE_HEIGHTS: &[u32] = &[
4194304, 4, 128, 2097152, 8388608, 4194304, 262144, 8388608, 16777216, 2097152, 16777216,
2097152, 8388608, 262144, 2097152, 1048576, 4194304, 1048576, 262144,
4194304, 4, 128, 2097152, 8388608, 4194304, 262144, 8388608, 16777216, 16777216, 2097152,
16777216, 2097152, 8388608, 262144, 2097152, 1048576, 4194304, 1048576, 262144,
];

pub struct CenoAggregationProver {
pub base_vk: ZKVMVerifyingKey<E, Basefold<E, BasefoldRSParams>>,
pub leaf_prover: VmInstance<BabyBearPoseidon2Engine, NativeBuilder>,
Expand Down Expand Up @@ -290,7 +291,7 @@ impl CenoAggregationProver {

// _debug: export
// let file =
// File::create(format!("leaf_proof_{:?}.bin", proof_idx)).expect("Create export proof file");
// File::create(format!("leaf_proof_{:?}.bin", proof_idx)).expect("Create export proof file");
// bincode::serialize_into(file, &leaf_proof).expect("failed to serialize leaf proof");

println!(
Expand All @@ -304,14 +305,28 @@ impl CenoAggregationProver {
})
.collect::<Vec<_>>();

// Aggregate tree to root proof
// Aggregate leaf proofs into a single internal proof via binary tree
let root_inner = self.aggregate_internal_proofs(leaf_proofs);

// Export e2e stark proof (used in verify_e2e_stark_proof)
VmStarkProof {
inner: root_inner,
user_public_values,
}
}

/// Aggregate leaf (or internal) proofs into a single root internal proof
/// via a binary tree of internal proving rounds.
pub fn aggregate_internal_proofs(&mut self, leaf_proofs: Vec<Proof<SC>>) -> Proof<SC> {
let start = Instant::now();

let mut internal_node_idx = -1;
let mut internal_node_height = 0;
let mut proofs = leaf_proofs;

println!(
"Aggregation - Start internal aggregation at: {:?}",
aggregation_start_timestamp.elapsed()
start.elapsed()
);
// We will always generate at least one internal proof, even if there is only one leaf
// proof, in order to shrink the proof size
Expand All @@ -321,7 +336,6 @@ impl CenoAggregationProver {
&proofs,
DEFAULT_NUM_CHILDREN_INTERNAL,
);

let layer_proofs: Vec<Proof<_>> = internal_inputs
.into_iter()
.map(|input| {
Expand All @@ -337,7 +351,7 @@ impl CenoAggregationProver {
"Aggregation - Completed internal node (idx: {:?}) at height {:?}: {:?}",
internal_node_idx,
internal_node_height,
aggregation_start_timestamp.elapsed()
start.elapsed()
);

// _debug: export
Expand All @@ -356,17 +370,13 @@ impl CenoAggregationProver {
}
println!(
"Aggregation - Completed internal aggregation at: {:?}",
aggregation_start_timestamp.elapsed()
start.elapsed()
);
println!("Aggregation - Final height: {:?}", internal_node_height);

// TODO: generate root proof from last internal proof

// Export e2e stark proof (used in verify_e2e_stark_proof)
VmStarkProof {
inner: proofs.pop().unwrap(),
user_public_values,
}
proofs.pop().unwrap()
}
}

Expand Down Expand Up @@ -693,6 +703,7 @@ pub fn verify_proofs(

let fri_params = standard_fri_params_with_100_bits_conjectured_security(1);
let vb = NativeBuilder::default();

air_test_impl::<BabyBearPoseidon2Engine, _>(
fri_params,
vb,
Expand All @@ -703,14 +714,21 @@ pub fn verify_proofs(
true,
)
.unwrap();

// _debug
// let engine = BabyBearPoseidon2Engine::new(fri_params);
// let (mut vm, pk) = VirtualMachine::new_with_keygen(engine, vb, config).expect("create vm");
// let vk = pk.get_vk();
// vm.verify(&vk, &proofs)
// .expect("segment proofs should verify");
}
}

#[cfg(test)]
mod tests {
use super::verify_e2e_stark_proof;
use crate::{
aggregation::{CenoAggregationProver, verify_proofs},
aggregation::{CenoAggregationProver, SC, verify_proofs},
zkvm_verifier::binding::E,
};
use ceno_zkvm::{
Expand All @@ -719,6 +737,7 @@ mod tests {
structs::ZKVMVerifyingKey,
};
use mpcs::{Basefold, BasefoldRSParams};
use openvm_stark_backend::proof::Proof;
use openvm_stark_sdk::{config::setup_tracing_with_log_level, p3_bn254_fr::Bn254Fr};
use p3::field::FieldAlgebra;
use std::fs::File;
Expand Down Expand Up @@ -785,6 +804,31 @@ mod tests {
verify(zkvm_proofs.clone(), &verifier).expect("Verification failed");
}

pub fn internal_aggregation_inner_thread() {
setup_tracing_with_log_level(tracing::Level::WARN);

let vk_path = "./src/imported/vk.bin";
let vk: ZKVMVerifyingKey<E, Basefold<E, BasefoldRSParams>> =
bincode::deserialize_from(File::open(vk_path).expect("Failed to open vk file"))
.expect("Failed to deserialize vk file");

let mut agg_prover = CenoAggregationProver::from_base_vk(vk);

// Load exported leaf proofs
let leaf_proof_0: Proof<SC> = bincode::deserialize_from(
File::open("./leaf_proof_0.bin").expect("Failed to open leaf_proof_0.bin"),
)
.expect("Failed to deserialize leaf_proof_0");
let leaf_proof_1: Proof<SC> = bincode::deserialize_from(
File::open("./leaf_proof_1.bin").expect("Failed to open leaf_proof_1.bin"),
)
.expect("Failed to deserialize leaf_proof_1");

let leaf_proofs = vec![leaf_proof_0, leaf_proof_1];
let _root_proof = agg_prover.aggregate_internal_proofs(leaf_proofs);
println!("Internal aggregation completed successfully");
}

#[test]
#[ignore = "need to generate proof first"]
pub fn test_aggregation() {
Expand All @@ -798,6 +842,19 @@ mod tests {
handler.join().expect("Thread panicked");
}

#[test]
#[ignore = "need to generate proof first"]
pub fn test_internal_aggregation() {
let stack_size = 256 * 1024 * 1024;

let handler = std::thread::Builder::new()
.stack_size(stack_size)
.spawn(internal_aggregation_inner_thread)
.expect("Failed to spawn thread");

handler.join().expect("Thread panicked");
}

#[test]
#[ignore = "need to generate proof first"]
pub fn test_single() {
Expand Down
30 changes: 0 additions & 30 deletions ceno_recursion/src/arithmetics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,6 @@ pub fn is_smaller_than<C: Config>(
RVar::from(v)
}

pub fn evaluate_at_point_degree_1<C: Config>(
builder: &mut Builder<C>,
evals: &Array<C, Ext<C::F, C::EF>>,
point: &Array<C, Ext<C::F, C::EF>>,
) -> Ext<C::F, C::EF> {
let left = builder.get(evals, 0);
let right = builder.get(evals, 1);
let r = builder.get(point, 0);

builder.eval(r * (right - left) + left)
}

pub fn _fixed_dot_product<C: Config>(
builder: &mut Builder<C>,
a: &[Ext<C::F, C::EF>],
Expand Down Expand Up @@ -329,24 +317,6 @@ pub fn eq_eval_with_index<C: Config>(
acc
}

// Multiply all elements in a nested Array
pub fn nested_product<C: Config>(
builder: &mut Builder<C>,
arr: &Array<C, Array<C, Ext<C::F, C::EF>>>,
) -> Ext<C::F, C::EF> {
let acc = builder.constant(C::EF::ONE);
iter_zip!(builder, arr).for_each(|ptr_vec, builder| {
let inner_arr = builder.iter_ptr_get(arr, ptr_vec[0]);

iter_zip!(builder, inner_arr).for_each(|ptr_vec, builder| {
let el = builder.iter_ptr_get(&inner_arr, ptr_vec[0]);
builder.assign(&acc, acc * el);
});
});

acc
}

// Multiply all elements in an Array
pub fn arr_product<C: Config>(
builder: &mut Builder<C>,
Expand Down
Loading