From a2e09f1306da312ed8256866b6d33affca6b06da Mon Sep 17 00:00:00 2001 From: "sm.wu" Date: Tue, 5 Nov 2024 22:29:21 +0800 Subject: [PATCH 1/4] chores: cleanup --- ceno_zkvm/src/instructions.rs | 4 ++-- ceno_zkvm/src/tables/mod.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ceno_zkvm/src/instructions.rs b/ceno_zkvm/src/instructions.rs index 63314cbee..eb24b7008 100644 --- a/ceno_zkvm/src/instructions.rs +++ b/ceno_zkvm/src/instructions.rs @@ -2,6 +2,7 @@ use std::mem::MaybeUninit; use ceno_emul::StepRecord; use ff_ext::ExtensionField; +use multilinear_extensions::util::max_usable_threads; use rayon::{ iter::{IndexedParallelIterator, ParallelIterator}, slice::ParallelSlice, @@ -47,8 +48,7 @@ pub trait Instruction { num_witin: usize, steps: Vec, ) -> Result<(RowMajorMatrix, LkMultiplicity), ZKVMError> { - let nthreads = - std::env::var("RAYON_NUM_THREADS").map_or(8, |s| s.parse::().unwrap_or(8)); + let nthreads = max_usable_threads(); let num_instance_per_batch = if steps.len() > 256 { steps.len().div_ceil(nthreads) } else { diff --git a/ceno_zkvm/src/tables/mod.rs b/ceno_zkvm/src/tables/mod.rs index 2ef7e293a..b27f04e54 100644 --- a/ceno_zkvm/src/tables/mod.rs +++ b/ceno_zkvm/src/tables/mod.rs @@ -4,6 +4,7 @@ use crate::{ }; use ff::Field; use ff_ext::ExtensionField; +use multilinear_extensions::util::max_usable_threads; use rayon::iter::{IndexedParallelIterator, ParallelIterator}; use std::{collections::HashMap, mem::MaybeUninit}; mod range; @@ -49,8 +50,7 @@ pub trait TableCircuit { // Fill the padding with zeros, if any. let num_padding_instances = table.num_padding_instances(); if num_padding_instances > 0 { - let nthreads = - std::env::var("RAYON_NUM_THREADS").map_or(8, |s| s.parse::().unwrap_or(8)); + let nthreads = max_usable_threads(); let padding_instance = vec![MaybeUninit::new(E::BaseField::ZERO); num_witin]; let num_padding_instance_per_batch = if num_padding_instances > 256 { num_padding_instances.div_ceil(nthreads) From 8a44d8eaa369f2211da8a36a69ef1dad4a48df24 Mon Sep 17 00:00:00 2001 From: "sm.wu" Date: Tue, 5 Nov 2024 22:39:55 +0800 Subject: [PATCH 2/4] mpcs: split rayon job into huge chunk --- mpcs/src/basefold/commit_phase.rs | 9 ++++++++- mpcs/src/util/merkle_tree.rs | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mpcs/src/basefold/commit_phase.rs b/mpcs/src/basefold/commit_phase.rs index fe6b2b1e9..a733dd82a 100644 --- a/mpcs/src/basefold/commit_phase.rs +++ b/mpcs/src/basefold/commit_phase.rs @@ -16,10 +16,13 @@ use crate::util::{ use ark_std::{end_timer, start_timer}; use ff_ext::ExtensionField; use itertools::Itertools; +use num_integer::Integer; use serde::{Serialize, de::DeserializeOwned}; use transcript::Transcript; -use multilinear_extensions::{mle::FieldType, virtual_poly::build_eq_x_r_vec}; +use multilinear_extensions::{ + mle::FieldType, util::max_usable_threads, virtual_poly::build_eq_x_r_vec, +}; use crate::util::plonky2_util::reverse_index_bits_in_place; use rayon::prelude::{ @@ -366,8 +369,12 @@ where let batch_codewords_timer = start_timer!(|| "Batch codewords"); let mut running_oracle = comm.batch_codewords(batch_coeffs); end_timer!(batch_codewords_timer); + let nthreads = max_usable_threads(); + let per_thread_size = (1 << num_vars).div_ceil(&nthreads); + let mut running_evals = (0..(1 << num_vars)) .into_par_iter() + .with_min_len(per_thread_size) .map(|i| { comm.polynomials_bh_evals .iter() diff --git a/mpcs/src/util/merkle_tree.rs b/mpcs/src/util/merkle_tree.rs index 66f896710..661a47dcc 100644 --- a/mpcs/src/util/merkle_tree.rs +++ b/mpcs/src/util/merkle_tree.rs @@ -1,6 +1,6 @@ use ff_ext::ExtensionField; use itertools::Itertools; -use multilinear_extensions::mle::FieldType; +use multilinear_extensions::{mle::FieldType, util::max_usable_threads}; use rayon::{ iter::{ IndexedParallelIterator, IntoParallelIterator, IntoParallelRefMutIterator, ParallelIterator, @@ -90,8 +90,11 @@ where } pub fn batch_leaves(&self, coeffs: &[E]) -> Vec { + let nthreads = max_usable_threads(); + let leafs_size = self.leaves[0].len().div_ceil(nthreads); (0..self.leaves[0].len()) .into_par_iter() + .with_min_len(leafs_size) .map(|i| { self.leaves .iter() From a756f466f7086bf5b204bff7afbf175c648050da Mon Sep 17 00:00:00 2001 From: "sm.wu" Date: Thu, 7 Nov 2024 01:04:14 +0800 Subject: [PATCH 3/4] mpcs flamegraph --- Cargo.lock | 3 ++ ceno_zkvm/src/scheme/prover.rs | 36 +++++++++-------- mpcs/Cargo.toml | 3 ++ mpcs/src/basefold/commit_phase.rs | 65 +++++++++++++++++++++---------- mpcs/src/util.rs | 1 + sumcheck/src/prover_v2.rs | 2 + 6 files changed, 74 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3d36b3144..809280d61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1001,6 +1001,9 @@ dependencies = [ "rand_chacha", "rayon", "serde", + "tracing", + "tracing-flame", + "tracing-subscriber", "transcript", ] diff --git a/ceno_zkvm/src/scheme/prover.rs b/ceno_zkvm/src/scheme/prover.rs index 45d0b163f..905a04f09 100644 --- a/ceno_zkvm/src/scheme/prover.rs +++ b/ceno_zkvm/src/scheme/prover.rs @@ -1025,24 +1025,25 @@ impl> ZKVMProver { .collect_vec(); // TODO implement mechanism to skip commitment - let span = entered_span!("pcs_opening"); let (fixed_opening_proof, fixed_commit) = if !fixed.is_empty() { - ( - Some( - PCS::simple_batch_open( - pp, - &fixed, - circuit_pk.fixed_commit_wd.as_ref().unwrap(), - &input_open_point, - fixed_in_evals.as_slice(), - transcript, - ) - .map_err(ZKVMError::PCSError)?, - ), - Some(PCS::get_pure_commitment( - circuit_pk.fixed_commit_wd.as_ref().unwrap(), - )), + let span = entered_span!("pcs_fixed_opening"); + let fixed_opening_proof = PCS::simple_batch_open( + pp, + &fixed, + circuit_pk.fixed_commit_wd.as_ref().unwrap(), + &input_open_point, + fixed_in_evals.as_slice(), + transcript, ) + .map_err(ZKVMError::PCSError)?; + exit_span!(span); + + let span = entered_span!("pcs_fixed_commitment"); + let fixed_commitment = + PCS::get_pure_commitment(circuit_pk.fixed_commit_wd.as_ref().unwrap()); + exit_span!(span); + + (Some(fixed_opening_proof), Some(fixed_commitment)) } else { (None, None) }; @@ -1055,6 +1056,7 @@ impl> ZKVMProver { fixed_in_evals, fixed_commit, ); + let span = entered_span!("pcs_witin_opening"); let wits_opening_proof = PCS::simple_batch_open( pp, &witnesses, @@ -1065,7 +1067,9 @@ impl> ZKVMProver { ) .map_err(ZKVMError::PCSError)?; exit_span!(span); + let span = entered_span!("pcs_witin_commitment"); let wits_commit = PCS::get_pure_commitment(&wits_commit); + exit_span!(span); tracing::debug!( "[table {}] build opening proof for {} polys at {:?}: values = {:?}, commit = {:?}", name, diff --git a/mpcs/Cargo.toml b/mpcs/Cargo.toml index 26ee123ba..8ac4aef06 100644 --- a/mpcs/Cargo.toml +++ b/mpcs/Cargo.toml @@ -22,6 +22,9 @@ plonky2.workspace = true poseidon.workspace = true rand.workspace = true rand_chacha.workspace = true +tracing.workspace = true +tracing-flame.workspace = true +tracing-subscriber.workspace = true rayon = { workspace = true, optional = true } serde.workspace = true transcript = { path = "../transcript" } diff --git a/mpcs/src/basefold/commit_phase.rs b/mpcs/src/basefold/commit_phase.rs index a733dd82a..43eae1e34 100644 --- a/mpcs/src/basefold/commit_phase.rs +++ b/mpcs/src/basefold/commit_phase.rs @@ -6,12 +6,15 @@ use super::{ sum_check_last_round, }, }; -use crate::util::{ - arithmetic::{interpolate_over_boolean_hypercube, interpolate2_weights}, - field_type_index_ext, field_type_iter_ext, - hash::write_digest_to_transcript, - log2_strict, - merkle_tree::MerkleTree, +use crate::{ + entered_span, exit_span, + util::{ + arithmetic::{interpolate_over_boolean_hypercube, interpolate2_weights}, + field_type_index_ext, field_type_iter_ext, + hash::write_digest_to_transcript, + log2_strict, + merkle_tree::MerkleTree, + }, }; use ark_std::{end_timer, start_timer}; use ff_ext::ExtensionField; @@ -361,14 +364,18 @@ pub fn simple_batch_commit_phase>( where E::BaseField: Serialize + DeserializeOwned, { - let timer = start_timer!(|| "Simple batch commit phase"); + // let timer = start_timer!(|| "Simple batch commit phase"); + let span = entered_span!("Simple batch commit phase"); assert_eq!(point.len(), num_vars); assert_eq!(comm.num_polys, batch_coeffs.len()); - let prepare_timer = start_timer!(|| "Prepare"); + // let prepare_timer = start_timer!(|| "Prepare"); + let prepare_span = entered_span!("Simple batch commit phase"); let mut trees = Vec::with_capacity(num_vars); - let batch_codewords_timer = start_timer!(|| "Batch codewords"); + // let batch_codewords_timer = start_timer!(|| "Batch codewords"); + let batch_codewords_timer_span = entered_span!("Simple batch commit phase"); let mut running_oracle = comm.batch_codewords(batch_coeffs); - end_timer!(batch_codewords_timer); + // end_timer!(batch_codewords_timer); + exit_span!(batch_codewords_timer_span); let nthreads = max_usable_threads(); let per_thread_size = (1 << num_vars).div_ceil(&nthreads); @@ -383,27 +390,35 @@ where .sum() }) .collect::>(); - end_timer!(prepare_timer); + // end_timer!(prepare_timer); + exit_span!(prepare_span); // eq is the evaluation representation of the eq(X,r) polynomial over the hypercube - let build_eq_timer = start_timer!(|| "Basefold::build eq"); + let build_eq_span = entered_span!("mpcs::build_eq_span"); + // let build_eq_timer = start_timer!(|| "Basefold::build eq"); let mut eq = build_eq_x_r_vec(point); - end_timer!(build_eq_timer); + // end_timer!(build_eq_timer); + exit_span!(build_eq_span); - let reverse_bits_timer = start_timer!(|| "Basefold::reverse bits"); + // let reverse_bits_timer = start_timer!(|| "Basefold::reverse bits"); + let reverse_bits_span = entered_span!("mpcs::reverse_bits_span"); reverse_index_bits_in_place(&mut eq); - end_timer!(reverse_bits_timer); + // end_timer!(reverse_bits_timer); + exit_span!(reverse_bits_span); - let sumcheck_timer = start_timer!(|| "Basefold sumcheck first round"); + let sumcheck_span = entered_span!("mpcs::sumcheck_first_round"); + // let sumcheck_timer = start_timer!(|| "Basefold sumcheck first round"); let mut last_sumcheck_message = sum_check_first_round(&mut eq, &mut running_evals); - end_timer!(sumcheck_timer); + // end_timer!(sumcheck_timer); + exit_span!(sumcheck_span); let mut sumcheck_messages = Vec::with_capacity(num_rounds); let mut roots = Vec::with_capacity(num_rounds - 1); let mut final_message = Vec::new(); let mut running_tree_inner = Vec::new(); for i in 0..num_rounds { - let sumcheck_timer = start_timer!(|| format!("Basefold round {}", i)); + // let sumcheck_timer = start_timer!(|| format!("Basefold round {}", i)); + let sumcheck_span = entered_span!("mpcs::sumcheck_round"); // For the first round, no need to send the running root, because this root is // committing to a vector that can be recovered from linearly combining other // already-committed vectors. @@ -414,6 +429,7 @@ where .get_and_append_challenge(b"commit round") .elements; + let inner_span = entered_span!("mpcs::fri_compute_new_running_oracle"); // Fold the current oracle for FRI let new_running_oracle = basefold_one_round_by_interpolation_weights::( pp, @@ -421,21 +437,28 @@ where &running_oracle, challenge, ); + exit_span!(inner_span); if i > 0 { + let inner_span = entered_span!("mpcs::oracle_to_mktree"); let running_tree = MerkleTree::::from_inner_leaves( running_tree_inner, FieldType::Ext(running_oracle), ); + exit_span!(inner_span); trees.push(running_tree); } if i < num_rounds - 1 { + let inner_span = entered_span!("mpcs::oracle_to_mktree"); last_sumcheck_message = sum_check_challenge_round(&mut eq, &mut running_evals, challenge); + exit_span!(inner_span); + let inner_span = entered_span!("mpcs::compute_inner_ext"); running_tree_inner = MerkleTree::::compute_inner_ext(&new_running_oracle); let running_root = MerkleTree::::root_from_inner(&running_tree_inner); write_digest_to_transcript(&running_root, transcript); + exit_span!(inner_span); roots.push(running_root); running_oracle = new_running_oracle; } else { @@ -480,9 +503,11 @@ where assert_eq!(basecode, new_running_oracle); } } - end_timer!(sumcheck_timer); + // end_timer!(sumcheck_timer); + exit_span!(sumcheck_span); } - end_timer!(timer); + // end_timer!(timer); + exit_span!(span); (trees, BasefoldCommitPhaseProof { sumcheck_messages, roots, diff --git a/mpcs/src/util.rs b/mpcs/src/util.rs index 80ecf2535..9066ce349 100644 --- a/mpcs/src/util.rs +++ b/mpcs/src/util.rs @@ -1,6 +1,7 @@ pub mod arithmetic; pub mod expression; pub mod hash; +pub mod macros; pub mod parallel; pub mod plonky2_util; use ff::{Field, PrimeField}; diff --git a/sumcheck/src/prover_v2.rs b/sumcheck/src/prover_v2.rs index f2ede8680..8144e3733 100644 --- a/sumcheck/src/prover_v2.rs +++ b/sumcheck/src/prover_v2.rs @@ -153,10 +153,12 @@ impl<'a, E: ExtensionField> IOPProverStateV2<'a, E> { let mut evaluations = AdditiveVec::new(max_degree + 1); // sum for all round poly evaluations vector + let span = entered_span!("main_thread_collect_univariate_result"); for _ in 0..max_thread_id { let round_poly_coeffs = thread_based_transcript.read_field_element_exts(); evaluations += AdditiveVec(round_poly_coeffs); } + exit_span!(span); let span = entered_span!("main_thread_get_challenge"); transcript.append_field_element_exts(&evaluations.0); From 4ef4ab1cd2713899ececce494ed0a82933c2a269 Mon Sep 17 00:00:00 2001 From: "sm.wu" Date: Wed, 13 Nov 2024 16:09:53 +0800 Subject: [PATCH 4/4] remove mpcs commit/opening --- ceno_zkvm/examples/riscv_opcodes.rs | 2 +- ceno_zkvm/src/scheme.rs | 12 ++--- ceno_zkvm/src/scheme/prover.rs | 74 +++++++++++++++-------------- ceno_zkvm/src/scheme/verifier.rs | 70 +++++++++++++-------------- mpcs/src/util/macros.rs | 24 ++++++++++ 5 files changed, 104 insertions(+), 78 deletions(-) create mode 100644 mpcs/src/util/macros.rs diff --git a/ceno_zkvm/examples/riscv_opcodes.rs b/ceno_zkvm/examples/riscv_opcodes.rs index 1decd91b2..49349b794 100644 --- a/ceno_zkvm/examples/riscv_opcodes.rs +++ b/ceno_zkvm/examples/riscv_opcodes.rs @@ -306,7 +306,7 @@ fn main() { println!( "riscv_opcodes::create_proof, instance_num_vars = {}, time = {}", instance_num_vars, - timer.elapsed().as_secs() + timer.elapsed() ); let transcript = Transcript::new(b"riscv"); diff --git a/ceno_zkvm/src/scheme.rs b/ceno_zkvm/src/scheme.rs index 1c781f720..f6479bf74 100644 --- a/ceno_zkvm/src/scheme.rs +++ b/ceno_zkvm/src/scheme.rs @@ -17,7 +17,7 @@ pub mod mock_prover; mod tests; #[derive(Clone)] -pub struct ZKVMOpcodeProof> { +pub struct ZKVMOpcodeProof { // TODO support >1 opcodes pub num_instances: usize, @@ -39,8 +39,8 @@ pub struct ZKVMOpcodeProof pub w_records_in_evals: Vec, pub lk_records_in_evals: Vec, - pub wits_commit: PCS::Commitment, - pub wits_opening_proof: PCS::Proof, + // pub wits_commit: PCS::Commitment, + // pub wits_opening_proof: PCS::Proof, pub wits_in_evals: Vec, } @@ -62,9 +62,9 @@ pub struct ZKVMTableProof> pub fixed_in_evals: Vec, pub fixed_opening_proof: Option, - pub wits_commit: PCS::Commitment, + // pub wits_commit: PCS::Commitment, pub wits_in_evals: Vec, - pub wits_opening_proof: PCS::Proof, + // pub wits_opening_proof: PCS::Proof, } /// each field will be interpret to (constant) polynomial @@ -122,7 +122,7 @@ pub struct ZKVMProof> { pub raw_pi: Vec>, // the evaluation of raw_pi. pub pi_evals: Vec, - opcode_proofs: BTreeMap)>, + opcode_proofs: BTreeMap)>, table_proofs: BTreeMap)>, } diff --git a/ceno_zkvm/src/scheme/prover.rs b/ceno_zkvm/src/scheme/prover.rs index e17280a8c..a2468e71a 100644 --- a/ceno_zkvm/src/scheme/prover.rs +++ b/ceno_zkvm/src/scheme/prover.rs @@ -6,7 +6,7 @@ use std::{ use ff::Field; use itertools::{Itertools, izip}; -use mpcs::PolynomialCommitmentScheme; +use mpcs::{CommitmentWithData, PolynomialCommitmentScheme}; use multilinear_extensions::{ mle::{IntoMLE, MultilinearExtension}, util::ceil_log2, @@ -99,8 +99,9 @@ impl> ZKVMProver { let witness = witness.into_mles(); commitments.insert( circuit_name.clone(), - PCS::batch_commit_and_write(&self.pk.pp, &witness, &mut transcript) - .map_err(ZKVMError::PCSError)?, + CommitmentWithData::::default(), + // PCS::batch_commit_and_write(&self.pk.pp, &witness, &mut transcript) + // .map_err(ZKVMError::PCSError)?, ); witness } @@ -214,7 +215,7 @@ impl> ZKVMProver { num_instances: usize, transcript: &mut Transcript, challenges: &[E; 2], - ) -> Result, ZKVMError> { + ) -> Result, ZKVMError> { let cs = circuit_pk.get_cs(); let next_pow2_instances = next_pow2_instance_padding(num_instances); let log2_num_instances = ceil_log2(next_pow2_instances); @@ -604,22 +605,23 @@ impl> ZKVMProver { witnesses.len(), input_open_point ); - let wits_opening_proof = PCS::simple_batch_open( - pp, - &witnesses, - &wits_commit, - &input_open_point, - wits_in_evals.as_slice(), - transcript, - ) - .map_err(ZKVMError::PCSError)?; + // let wits_opening_proof = PCS::simple_batch_open( + // pp, + // &witnesses, + // &wits_commit, + // &input_open_point, + // wits_in_evals.as_slice(), + // transcript, + // ) + // .map_err(ZKVMError::PCSError)?; + tracing::info!( "[opcode {}] build opening proof took {:?}", name, opening_dur.elapsed(), ); exit_span!(pcs_open_span); - let wits_commit = PCS::get_pure_commitment(&wits_commit); + // let wits_commit = PCS::get_pure_commitment(&wits_commit); Ok(ZKVMOpcodeProof { num_instances, @@ -634,8 +636,8 @@ impl> ZKVMProver { r_records_in_evals, w_records_in_evals, lk_records_in_evals, - wits_commit, - wits_opening_proof, + // wits_commit, + // wits_opening_proof, wits_in_evals, }) } @@ -1069,27 +1071,27 @@ impl> ZKVMProver { fixed_commit, ); let span = entered_span!("pcs_witin_opening"); - let wits_opening_proof = PCS::simple_batch_open( - pp, - &witnesses, - &wits_commit, - &input_open_point, - wits_in_evals.as_slice(), - transcript, - ) - .map_err(ZKVMError::PCSError)?; + // let wits_opening_proof = PCS::simple_batch_open( + // pp, + // &witnesses, + // &wits_commit, + // &input_open_point, + // wits_in_evals.as_slice(), + // transcript, + // ) + // .map_err(ZKVMError::PCSError)?; exit_span!(pcs_opening); let pcs_witin_commitment = entered_span!("pcs_witin_commitment"); - let wits_commit = PCS::get_pure_commitment(&wits_commit); + // let wits_commit = PCS::get_pure_commitment(&wits_commit); exit_span!(pcs_witin_commitment); - tracing::debug!( - "[table {}] build opening proof for {} polys at {:?}: values = {:?}, commit = {:?}", - name, - witnesses.len(), - input_open_point, - wits_in_evals, - wits_commit, - ); + // tracing::debug!( + // "[table {}] build opening proof for {} polys at {:?}: values = {:?}, commit = {:?}", + // name, + // witnesses.len(), + // input_open_point, + // wits_in_evals, + // wits_commit, + // ); Ok(( ZKVMTableProof { @@ -1104,8 +1106,8 @@ impl> ZKVMProver { fixed_opening_proof, rw_hints_num_vars, wits_in_evals, - wits_commit, - wits_opening_proof, + // wits_commit, + // wits_opening_proof, }, pi_in_evals, )) diff --git a/ceno_zkvm/src/scheme/verifier.rs b/ceno_zkvm/src/scheme/verifier.rs index 75e91b576..ce69a46b4 100644 --- a/ceno_zkvm/src/scheme/verifier.rs +++ b/ceno_zkvm/src/scheme/verifier.rs @@ -99,14 +99,14 @@ impl> ZKVMVerifier } } - for (_, (_, proof)) in vm_proof.opcode_proofs.iter() { - PCS::write_commitment(&proof.wits_commit, &mut transcript) - .map_err(ZKVMError::PCSError)?; - } - for (_, (_, proof)) in vm_proof.table_proofs.iter() { - PCS::write_commitment(&proof.wits_commit, &mut transcript) - .map_err(ZKVMError::PCSError)?; - } + // for (_, (_, proof)) in vm_proof.opcode_proofs.iter() { + // PCS::write_commitment(&proof.wits_commit, &mut transcript) + // .map_err(ZKVMError::PCSError)?; + // } + // for (_, (_, proof)) in vm_proof.table_proofs.iter() { + // PCS::write_commitment(&proof.wits_commit, &mut transcript) + // .map_err(ZKVMError::PCSError)?; + // } // alpha, beta let challenges = [ @@ -233,7 +233,7 @@ impl> ZKVMVerifier name: &str, vp: &PCS::VerifierParam, circuit_vk: &VerifyingKey, - proof: &ZKVMOpcodeProof, + proof: &ZKVMOpcodeProof, pi: &[E], transcript: &mut Transcript, num_product_fanin: usize, @@ -463,15 +463,15 @@ impl> ZKVMVerifier proof.wits_in_evals.len(), input_opening_point ); - PCS::simple_batch_verify( - vp, - &proof.wits_commit, - &input_opening_point, - &proof.wits_in_evals, - &proof.wits_opening_proof, - transcript, - ) - .map_err(ZKVMError::PCSError)?; + // PCS::simple_batch_verify( + // vp, + // &proof.wits_commit, + // &input_opening_point, + // &proof.wits_in_evals, + // &proof.wits_opening_proof, + // transcript, + // ) + // .map_err(ZKVMError::PCSError)?; Ok(input_opening_point) } @@ -761,23 +761,23 @@ impl> ZKVMVerifier circuit_vk.fixed_commit, ); - PCS::simple_batch_verify( - vp, - &proof.wits_commit, - &input_opening_point, - &proof.wits_in_evals, - &proof.wits_opening_proof, - transcript, - ) - .map_err(ZKVMError::PCSError)?; - tracing::debug!( - "[table {}] verified opening proof for {} polys at {:?}: values = {:?}, commit = {:?}", - name, - proof.wits_in_evals.len(), - input_opening_point, - proof.wits_in_evals, - proof.wits_commit - ); + // PCS::simple_batch_verify( + // vp, + // &proof.wits_commit, + // &input_opening_point, + // &proof.wits_in_evals, + // &proof.wits_opening_proof, + // transcript, + // ) + // .map_err(ZKVMError::PCSError)?; + // tracing::debug!( + // "[table {}] verified opening proof for {} polys at {:?}: values = {:?}, commit = {:?}", + // name, + // proof.wits_in_evals.len(), + // input_opening_point, + // proof.wits_in_evals, + // proof.wits_commit + // ); Ok(input_opening_point) } diff --git a/mpcs/src/util/macros.rs b/mpcs/src/util/macros.rs new file mode 100644 index 000000000..a8c63206a --- /dev/null +++ b/mpcs/src/util/macros.rs @@ -0,0 +1,24 @@ +#[macro_export] +macro_rules! entered_span { + ($first:expr, $($fields:tt)*) => { + $crate::tracing_span!($first, $($fields)*).entered() + }; + ($first:expr $(,)*) => { + $crate::tracing_span!($first).entered() + }; +} +#[macro_export] +macro_rules! tracing_span { + ($first:expr, $($fields:tt)*) => { + tracing::span!(tracing::Level::INFO, $first, $($fields)*) + }; + ($first:expr $(,)*) => { + tracing::span!(tracing::Level::INFO, $first) + }; +} +#[macro_export] +macro_rules! exit_span { + ($first:expr $(,)*) => { + $first.exit(); + }; +}