Skip to content

Commit

Permalink
tower product sumcheck prove/verify
Browse files Browse the repository at this point in the history
  • Loading branch information
hero78119 committed Aug 1, 2024
1 parent e84331c commit bd7771b
Show file tree
Hide file tree
Showing 11 changed files with 685 additions and 297 deletions.
2 changes: 1 addition & 1 deletion ceno_zkvm/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use singer_utils::error::UtilError;
pub enum ZKVMError {
CircuitError,
UtilError(UtilError),
VerifyError,
VerifyError(&'static str),
}

impl From<UtilError> for ZKVMError {
Expand Down
3 changes: 2 additions & 1 deletion ceno_zkvm/src/instructions/riscv/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ mod test {
use singer_utils::{structs_v2::CircuitBuilderV2, util_v2::InstructionV2};
use transcript::Transcript;

use crate::scheme::{prover::ZKVMProver, verifier::ZKVMVerifier};
use crate::scheme::{constants::NUM_PRODUCT_FANIN, prover::ZKVMProver, verifier::ZKVMVerifier};

use super::AddInstruction;

Expand Down Expand Up @@ -163,6 +163,7 @@ mod test {
.verify(
&mut proof,
&mut v_transcript,
NUM_PRODUCT_FANIN,
&PointAndEval::default(),
&challenges,
)
Expand Down
1 change: 1 addition & 0 deletions ceno_zkvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ pub mod instructions;
pub mod scheme;
// #[cfg(test)]
pub use utils::u64vec;
mod structs;
mod utils;
12 changes: 9 additions & 3 deletions ceno_zkvm/src/scheme.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
use ff_ext::ExtensionField;
use sumcheck::structs::IOPProverMessage;

mod constants;
use crate::structs::TowerProofs;

pub mod constants;
pub mod prover;
mod utils;
pub mod verifier;

#[derive(Clone)]
pub struct ZKVMProof<E: ExtensionField> {
// TODO support >1 opcodes
pub num_instances: usize,

// product constraints
pub record_r_out_evals: Vec<E>,
pub record_w_out_evals: Vec<E>,
pub tower_proof: TowerProofs<E>,

// main constraint and select sumcheck proof
pub out_record_r_eval: E,
pub out_record_w_eval: E,
pub main_sel_sumcheck_proofs: Vec<IOPProverMessage<E>>,
pub r_records_in_evals: Vec<E>,
pub w_records_in_evals: Vec<E>,
Expand Down
2 changes: 1 addition & 1 deletion ceno_zkvm/src/scheme/constants.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub(crate) const MIN_PAR_SIZE: usize = 64;
pub(crate) const MAINCONSTRAIN_SUMCHECK_BATCH_SIZE: usize = 2;
pub(crate) const PRODUCT_ARGUMENT_SIZE: usize = 2;
pub const NUM_PRODUCT_FANIN: usize = 2;
Loading

0 comments on commit bd7771b

Please sign in to comment.