/ algorithms / src / polycommit / test_templates.rs
test_templates.rs
  1  // Copyright (c) 2025-2026 ACDC Network
  2  // This file is part of the alphavm library.
  3  //
  4  // Alpha Chain | Delta Chain Protocol
  5  // International Monetary Graphite.
  6  //
  7  // Derived from Aleo (https://aleo.org) and ProvableHQ (https://provable.com).
  8  // They built world-class ZK infrastructure. We installed the EASY button.
  9  // Their cryptography: elegant. Our modifications: bureaucracy-compatible.
 10  // Original brilliance: theirs. Robert's Rules: ours. Bugs: definitely ours.
 11  //
 12  // Original Aleo/ProvableHQ code subject to Apache 2.0 https://www.apache.org/licenses/LICENSE-2.0
 13  // All modifications and new work: CC0 1.0 Universal Public Domain Dedication.
 14  // No rights reserved. No permission required. No warranty. No refunds.
 15  //
 16  // https://creativecommons.org/publicdomain/zero/1.0/
 17  // SPDX-License-Identifier: CC0-1.0
 18  
 19  use super::sonic_pc::{
 20      BatchLCProof,
 21      BatchProof,
 22      Commitment,
 23      CommitterUnionKey,
 24      Evaluations,
 25      LabeledCommitment,
 26      QuerySet,
 27      Randomness,
 28      SonicKZG10,
 29  };
 30  use crate::{
 31      fft::DensePolynomial,
 32      polycommit::{
 33          sonic_pc::{LabeledPolynomial, LabeledPolynomialWithBasis, LinearCombination},
 34          PCError,
 35      },
 36      srs::UniversalVerifier,
 37      AlgebraicSponge,
 38  };
 39  use alphavm_curves::PairingEngine;
 40  use alphavm_fields::{One, Zero};
 41  use alphavm_utilities::rand::{TestRng, Uniform};
 42  
 43  use itertools::Itertools;
 44  use rand::{
 45      distributions::{self, Distribution},
 46      Rng,
 47  };
 48  use std::marker::PhantomData;
 49  
 50  #[derive(Default)]
 51  struct TestInfo {
 52      num_iters: usize,
 53      max_degree: Option<usize>,
 54      supported_degree: Option<usize>,
 55      num_polynomials: usize,
 56      enforce_degree_bounds: bool,
 57      max_num_queries: usize,
 58      num_equations: Option<usize>,
 59  }
 60  
 61  pub struct TestComponents<E: PairingEngine, S: AlgebraicSponge<E::Fq, 2>> {
 62      pub verification_key: UniversalVerifier<E>,
 63      pub commitments: Vec<LabeledCommitment<Commitment<E>>>,
 64      pub query_set: QuerySet<E::Fr>,
 65      pub evaluations: Evaluations<E::Fr>,
 66      pub batch_lc_proof: Option<BatchLCProof<E>>,
 67      pub batch_proof: Option<BatchProof<E>>,
 68      pub randomness: Vec<Randomness<E>>,
 69      _sponge: PhantomData<S>,
 70  }
 71  
 72  pub fn bad_degree_bound_test<E: PairingEngine, S: AlgebraicSponge<E::Fq, 2>>() -> Result<(), PCError> {
 73      let rng = &mut TestRng::default();
 74      let max_degree = 100;
 75      let pp = SonicKZG10::<E, S>::load_srs(max_degree)?;
 76      let universal_prover = &pp.to_universal_prover().unwrap();
 77  
 78      for _ in 0..10 {
 79          let supported_degree = distributions::Uniform::from(1..=max_degree).sample(rng);
 80          assert!(max_degree >= supported_degree, "max_degree < supported_degree");
 81  
 82          let mut labels = Vec::new();
 83          let mut polynomials = Vec::new();
 84          let mut degree_bounds = Vec::new();
 85  
 86          for i in 0..10 {
 87              let label = format!("Test{i}");
 88              labels.push(label.clone());
 89              let poly = DensePolynomial::rand(supported_degree, rng);
 90  
 91              let degree_bound = 1usize;
 92              let hiding_bound = Some(1);
 93              degree_bounds.push(degree_bound);
 94  
 95              polynomials.push(LabeledPolynomial::new(label, poly, Some(degree_bound), hiding_bound))
 96          }
 97  
 98          println!("supported degree: {supported_degree:?}");
 99          let (ck, vk) =
100              SonicKZG10::<E, S>::trim(&pp, supported_degree, None, supported_degree, Some(degree_bounds.as_slice()))
101                  .unwrap();
102          println!("Trimmed");
103  
104          let ck = CommitterUnionKey::union(std::iter::once(&ck));
105  
106          let (comms, rands) =
107              SonicKZG10::<E, S>::commit(universal_prover, &ck, polynomials.iter().map(Into::into), Some(rng))?;
108  
109          let mut query_set = QuerySet::new();
110          let mut values = Evaluations::new();
111          let point = E::Fr::rand(rng);
112          for (i, label) in labels.iter().enumerate() {
113              query_set.insert((label.clone(), ("rand".into(), point)));
114              let value = polynomials[i].evaluate(point);
115              values.insert((label.clone(), point), value);
116          }
117          println!("Generated query set");
118  
119          let mut sponge_for_open = S::new();
120          let proof = SonicKZG10::batch_open(
121              universal_prover,
122              &ck,
123              polynomials.iter(),
124              &query_set,
125              rands.iter(),
126              &mut sponge_for_open,
127          )?;
128          let mut sponge_for_check = S::new();
129          let result = SonicKZG10::batch_check(&vk, &comms, &query_set, &values, &proof, &mut sponge_for_check)?;
130          assert!(result, "proof was incorrect, Query set: {query_set:#?}");
131      }
132      Ok(())
133  }
134  
135  pub fn lagrange_test_template<E: PairingEngine, S: AlgebraicSponge<E::Fq, 2>>(
136  ) -> Result<Vec<TestComponents<E, S>>, PCError> {
137      let num_iters = 10usize;
138      let max_degree = 256usize;
139      let supported_degree = 127usize;
140      let eval_size = 128usize;
141      let num_polynomials = 1usize;
142      let max_num_queries = 2usize;
143      let mut test_components = Vec::new();
144  
145      let rng = &mut TestRng::default();
146      let pp = SonicKZG10::<E, S>::load_srs(max_degree)?;
147      let universal_prover = &pp.to_universal_prover().unwrap();
148  
149      for _ in 0..num_iters {
150          assert!(max_degree >= supported_degree, "max_degree < supported_degree");
151          let mut polynomials = Vec::new();
152          let mut lagrange_polynomials = Vec::new();
153          let mut supported_lagrange_sizes = Vec::new();
154          let degree_bounds = None;
155  
156          let mut labels = Vec::new();
157          println!("Sampled supported degree");
158  
159          // Generate polynomials
160          let num_points_in_query_set = distributions::Uniform::from(1..=max_num_queries).sample(rng);
161          for i in 0..num_polynomials {
162              let label = format!("Test{i}");
163              labels.push(label.clone());
164              let eval_size: usize = distributions::Uniform::from(1..eval_size).sample(rng).next_power_of_two();
165              let mut evals = vec![E::Fr::zero(); eval_size];
166              for e in &mut evals {
167                  *e = E::Fr::rand(rng);
168              }
169              let domain = crate::fft::EvaluationDomain::new(evals.len()).unwrap();
170              let evals = crate::fft::Evaluations::from_vec_and_domain(evals, domain);
171              let poly = evals.interpolate_by_ref();
172              supported_lagrange_sizes.push(domain.size());
173              assert_eq!(poly.evaluate_over_domain_by_ref(domain), evals);
174  
175              let degree_bound = None;
176  
177              let hiding_bound = Some(1);
178              polynomials.push(LabeledPolynomial::new(label.clone(), poly, degree_bound, hiding_bound));
179              lagrange_polynomials.push(LabeledPolynomialWithBasis::new_lagrange_basis(label, evals, hiding_bound))
180          }
181          let supported_hiding_bound = polynomials.iter().map(|p| p.hiding_bound().unwrap_or(0)).max().unwrap_or(0);
182          println!("supported degree: {supported_degree:?}");
183          println!("supported hiding bound: {supported_hiding_bound:?}");
184          println!("num_points_in_query_set: {num_points_in_query_set:?}");
185          let (ck, vk_orig) = SonicKZG10::<E, S>::trim(
186              &pp,
187              supported_degree,
188              supported_lagrange_sizes,
189              supported_hiding_bound,
190              degree_bounds,
191          )
192          .unwrap();
193          println!("Trimmed");
194  
195          let ck = CommitterUnionKey::union(std::iter::once(&ck));
196          let vk = pp.to_universal_verifier().unwrap();
197  
198          let (comms, rands) =
199              SonicKZG10::<E, S>::commit(universal_prover, &ck, lagrange_polynomials, Some(rng)).unwrap();
200  
201          // Construct query set
202          let mut query_set = QuerySet::new();
203          let mut values = Evaluations::new();
204          // let mut point = E::Fr::one();
205          for point_id in 0..num_points_in_query_set {
206              let point = E::Fr::rand(rng);
207              for (polynomial, label) in polynomials.iter().zip_eq(labels.iter()) {
208                  query_set.insert((label.clone(), (format!("rand_{point_id}"), point)));
209                  let value = polynomial.evaluate(point);
210                  values.insert((label.clone(), point), value);
211              }
212          }
213          println!("Generated query set");
214  
215          let mut sponge_for_open = S::new();
216          let proof = SonicKZG10::batch_open(
217              universal_prover,
218              &ck,
219              polynomials.iter(),
220              &query_set,
221              rands.iter(),
222              &mut sponge_for_open,
223          )?;
224          let mut sponge_for_check = S::new();
225          let result = SonicKZG10::batch_check(&vk, &comms, &query_set, &values, &proof, &mut sponge_for_check)?;
226          if !result {
227              println!("Failed with {num_polynomials} polynomials, num_points_in_query_set: {num_points_in_query_set:?}");
228              println!("Degree of polynomials:");
229              for poly in polynomials {
230                  println!("Degree: {:?}", poly.degree());
231              }
232          }
233          assert!(result, "proof was incorrect, Query set: {query_set:#?}");
234  
235          test_components.push(TestComponents {
236              verification_key: vk_orig,
237              commitments: comms,
238              query_set,
239              evaluations: values,
240              batch_lc_proof: None,
241              batch_proof: Some(proof),
242              randomness: rands,
243              _sponge: PhantomData,
244          });
245      }
246      Ok(test_components)
247  }
248  
249  fn test_template<E, S>(info: TestInfo) -> Result<Vec<TestComponents<E, S>>, PCError>
250  where
251      E: PairingEngine,
252      S: AlgebraicSponge<E::Fq, 2>,
253  {
254      let TestInfo {
255          num_iters,
256          max_degree,
257          supported_degree,
258          num_polynomials,
259          enforce_degree_bounds,
260          max_num_queries,
261          ..
262      } = info;
263  
264      let mut test_components = Vec::new();
265  
266      let rng = &mut TestRng::default();
267      let max_degree = max_degree.unwrap_or_else(|| distributions::Uniform::from(8..=64).sample(rng));
268      let pp = SonicKZG10::<E, S>::load_srs(max_degree)?;
269      let universal_prover = &pp.to_universal_prover().unwrap();
270      let supported_degree_bounds = [1 << 10, 1 << 15, 1 << 20, 1 << 25, 1 << 30];
271  
272      for _ in 0..num_iters {
273          let supported_degree =
274              supported_degree.unwrap_or_else(|| distributions::Uniform::from(4..=max_degree).sample(rng));
275          assert!(max_degree >= supported_degree, "max_degree < supported_degree");
276          let mut polynomials = Vec::new();
277          let mut degree_bounds = if enforce_degree_bounds { Some(Vec::new()) } else { None };
278  
279          let mut labels = Vec::new();
280          println!("Sampled supported degree");
281  
282          // Generate polynomials
283          let num_points_in_query_set = distributions::Uniform::from(1..=max_num_queries).sample(rng);
284          for i in 0..num_polynomials {
285              let label = format!("Test{i}");
286              labels.push(label.clone());
287              let degree = distributions::Uniform::from(1..=supported_degree).sample(rng);
288              let poly = DensePolynomial::rand(degree, rng);
289  
290              let supported_degree_bounds_after_trimmed = supported_degree_bounds
291                  .iter()
292                  .copied()
293                  .filter(|x| *x >= degree && *x < supported_degree)
294                  .collect::<Vec<usize>>();
295  
296              let degree_bound = if let Some(degree_bounds) = &mut degree_bounds {
297                  if !supported_degree_bounds_after_trimmed.is_empty() && rng.r#gen() {
298                      let range = distributions::Uniform::from(0..supported_degree_bounds_after_trimmed.len());
299                      let idx = range.sample(rng);
300  
301                      let degree_bound = supported_degree_bounds_after_trimmed[idx];
302                      degree_bounds.push(degree_bound);
303                      Some(degree_bound)
304                  } else {
305                      None
306                  }
307              } else {
308                  None
309              };
310  
311              let hiding_bound = Some(1);
312              println!("Hiding bound: {hiding_bound:?}");
313  
314              polynomials.push(LabeledPolynomial::new(label, poly, degree_bound, hiding_bound))
315          }
316          let supported_hiding_bound = polynomials.iter().map(|p| p.hiding_bound().unwrap_or(0)).max().unwrap_or(0);
317          println!("supported degree: {supported_degree:?}");
318          println!("supported hiding bound: {supported_hiding_bound:?}");
319          println!("num_points_in_query_set: {num_points_in_query_set:?}");
320          let (ck, vk_orig) =
321              SonicKZG10::<E, S>::trim(&pp, supported_degree, None, supported_hiding_bound, degree_bounds.as_deref())
322                  .unwrap();
323          println!("Trimmed");
324  
325          let ck = CommitterUnionKey::union(std::iter::once(&ck));
326          let vk = pp.to_universal_verifier().unwrap();
327  
328          let (comms, rands) =
329              SonicKZG10::<E, S>::commit(universal_prover, &ck, polynomials.iter().map(Into::into), Some(rng))?;
330  
331          // Construct query set
332          let mut query_set = QuerySet::new();
333          let mut values = Evaluations::new();
334          // let mut point = E::Fr::one();
335          for point_id in 0..num_points_in_query_set {
336              let point = E::Fr::rand(rng);
337              for (polynomial, label) in polynomials.iter().zip_eq(labels.iter()) {
338                  query_set.insert((label.clone(), (format!("rand_{point_id}"), point)));
339                  let value = polynomial.evaluate(point);
340                  values.insert((label.clone(), point), value);
341              }
342          }
343          println!("Generated query set");
344  
345          let mut sponge_for_open = S::new();
346          let proof = SonicKZG10::batch_open(
347              universal_prover,
348              &ck,
349              polynomials.iter(),
350              &query_set,
351              rands.iter(),
352              &mut sponge_for_open,
353          )?;
354          let mut sponge_for_check = S::new();
355          let result = SonicKZG10::batch_check(&vk, &comms, &query_set, &values, &proof, &mut sponge_for_check)?;
356          if !result {
357              println!("Failed with {num_polynomials} polynomials, num_points_in_query_set: {num_points_in_query_set:?}");
358              println!("Degree of polynomials:");
359              for poly in polynomials {
360                  println!("Degree: {:?}", poly.degree());
361              }
362          }
363          assert!(result, "proof was incorrect, Query set: {query_set:#?}");
364  
365          test_components.push(TestComponents {
366              verification_key: vk_orig,
367              commitments: comms,
368              query_set,
369              evaluations: values,
370              batch_lc_proof: None,
371              batch_proof: Some(proof),
372              randomness: rands,
373              _sponge: PhantomData,
374          });
375      }
376      Ok(test_components)
377  }
378  
379  fn equation_test_template<E: PairingEngine, S: AlgebraicSponge<E::Fq, 2>>(
380      info: TestInfo,
381  ) -> Result<Vec<TestComponents<E, S>>, PCError> {
382      let TestInfo {
383          num_iters,
384          max_degree,
385          supported_degree,
386          num_polynomials,
387          enforce_degree_bounds,
388          max_num_queries,
389          num_equations,
390      } = info;
391  
392      let mut test_components = Vec::new();
393  
394      let rng = &mut TestRng::default();
395      let max_degree = max_degree.unwrap_or_else(|| distributions::Uniform::from(8..=64).sample(rng));
396      let pp = SonicKZG10::<E, S>::load_srs(max_degree)?;
397      let universal_prover = &pp.to_universal_prover().unwrap();
398      let supported_degree_bounds = [1 << 10, 1 << 15, 1 << 20, 1 << 25, 1 << 30];
399  
400      for _ in 0..num_iters {
401          let supported_degree =
402              supported_degree.unwrap_or_else(|| distributions::Uniform::from(4..=max_degree).sample(rng));
403          assert!(max_degree >= supported_degree, "max_degree < supported_degree");
404          let mut polynomials = Vec::new();
405          let mut degree_bounds = if enforce_degree_bounds { Some(Vec::new()) } else { None };
406  
407          let mut labels = Vec::new();
408          println!("Sampled supported degree");
409  
410          // Generate polynomials
411          let num_points_in_query_set = distributions::Uniform::from(1..=max_num_queries).sample(rng);
412          for i in 0..num_polynomials {
413              let label = format!("Test{i}");
414              labels.push(label.clone());
415              let degree = distributions::Uniform::from(1..=supported_degree).sample(rng);
416              let poly = DensePolynomial::rand(degree, rng);
417  
418              let supported_degree_bounds_after_trimmed = supported_degree_bounds
419                  .iter()
420                  .copied()
421                  .filter(|x| *x >= degree && *x < supported_degree)
422                  .collect::<Vec<usize>>();
423  
424              let degree_bound = if let Some(degree_bounds) = &mut degree_bounds {
425                  if !supported_degree_bounds_after_trimmed.is_empty() && rng.r#gen() {
426                      let range = distributions::Uniform::from(0..supported_degree_bounds_after_trimmed.len());
427                      let idx = range.sample(rng);
428  
429                      let degree_bound = supported_degree_bounds_after_trimmed[idx];
430                      degree_bounds.push(degree_bound);
431                      Some(degree_bound)
432                  } else {
433                      None
434                  }
435              } else {
436                  None
437              };
438  
439              let hiding_bound = Some(1);
440              println!("Hiding bound: {hiding_bound:?}");
441  
442              polynomials.push(LabeledPolynomial::new(label, poly, degree_bound, hiding_bound))
443          }
444          let supported_hiding_bound = polynomials.iter().map(|p| p.hiding_bound().unwrap_or(0)).max().unwrap_or(0);
445          println!("supported degree: {supported_degree:?}");
446          println!("supported hiding bound: {supported_hiding_bound:?}");
447          println!("num_points_in_query_set: {num_points_in_query_set:?}");
448          println!("{degree_bounds:?}");
449          println!("{num_polynomials}");
450          println!("{enforce_degree_bounds}");
451  
452          let (ck, vk_orig) =
453              SonicKZG10::<E, S>::trim(&pp, supported_degree, None, supported_hiding_bound, degree_bounds.as_deref())
454                  .unwrap();
455          println!("Trimmed");
456  
457          let ck = CommitterUnionKey::union(std::iter::once(&ck));
458          let vk = pp.to_universal_verifier().unwrap();
459  
460          let (comms, rands) =
461              SonicKZG10::<E, S>::commit(universal_prover, &ck, polynomials.iter().map(Into::into), Some(rng))?;
462  
463          // Let's construct our equations
464          let mut linear_combinations = Vec::new();
465          let mut query_set = QuerySet::new();
466          let mut values = Evaluations::new();
467          for i in 0..num_points_in_query_set {
468              let point = E::Fr::rand(rng);
469              for j in 0..num_equations.unwrap() {
470                  let label = format!("query {i} eqn {j}");
471                  let mut lc = LinearCombination::empty(label.clone());
472  
473                  let mut value = E::Fr::zero();
474                  let should_have_degree_bounds: bool = rng.r#gen();
475                  for (k, label) in labels.iter().enumerate() {
476                      if should_have_degree_bounds {
477                          value += &polynomials[k].evaluate(point);
478                          lc.add(E::Fr::one(), label.clone());
479                          break;
480                      } else {
481                          let poly = &polynomials[k];
482                          if poly.degree_bound().is_some() {
483                              continue;
484                          } else {
485                              assert!(poly.degree_bound().is_none());
486                              let coeff = E::Fr::rand(rng);
487                              value += &(coeff * poly.evaluate(point));
488                              lc.add(coeff, label.clone());
489                          }
490                      }
491                  }
492                  values.insert((label.clone(), point), value);
493                  if !lc.is_empty() {
494                      linear_combinations.push(lc);
495                      // Insert query
496                      query_set.insert((label.clone(), (format!("rand_{i}"), point)));
497                  }
498              }
499          }
500          if linear_combinations.is_empty() {
501              continue;
502          }
503          println!("Generated query set");
504          println!("Linear combinations: {linear_combinations:?}");
505  
506          let mut sponge_for_open = S::new();
507          let proof = SonicKZG10::open_combinations(
508              universal_prover,
509              &ck,
510              &linear_combinations,
511              polynomials,
512              &rands,
513              &query_set,
514              &mut sponge_for_open,
515          )?;
516          println!("Generated proof");
517          let mut sponge_for_check = S::new();
518          let result = SonicKZG10::check_combinations(
519              &vk,
520              &linear_combinations,
521              &comms,
522              &query_set,
523              &values,
524              &proof,
525              &mut sponge_for_check,
526          )?;
527          if !result {
528              println!("Failed with {num_polynomials} polynomials, num_points_in_query_set: {num_points_in_query_set:?}");
529          }
530          assert!(result, "proof was incorrect, equations: {linear_combinations:#?}");
531  
532          test_components.push(TestComponents {
533              verification_key: vk_orig,
534              commitments: comms,
535              query_set,
536              evaluations: values,
537              batch_lc_proof: Some(proof),
538              batch_proof: None,
539              randomness: rands,
540              _sponge: PhantomData,
541          });
542      }
543      Ok(test_components)
544  }
545  
546  pub fn single_poly_test<E, S>() -> Result<Vec<TestComponents<E, S>>, PCError>
547  where
548      E: PairingEngine,
549      S: AlgebraicSponge<E::Fq, 2>,
550  {
551      let info = TestInfo {
552          num_iters: 100,
553          max_degree: None,
554          supported_degree: None,
555          num_polynomials: 1,
556          enforce_degree_bounds: false,
557          max_num_queries: 1,
558          ..Default::default()
559      };
560      test_template::<E, S>(info)
561  }
562  
563  pub fn linear_poly_degree_bound_test<E, S>() -> Result<Vec<TestComponents<E, S>>, PCError>
564  where
565      E: PairingEngine,
566      S: AlgebraicSponge<E::Fq, 2>,
567  {
568      let info = TestInfo {
569          num_iters: 100,
570          max_degree: Some(2),
571          supported_degree: Some(1),
572          num_polynomials: 1,
573          enforce_degree_bounds: true,
574          max_num_queries: 1,
575          ..Default::default()
576      };
577      test_template::<E, S>(info)
578  }
579  
580  pub fn single_poly_degree_bound_test<E, S>() -> Result<Vec<TestComponents<E, S>>, PCError>
581  where
582      E: PairingEngine,
583      S: AlgebraicSponge<E::Fq, 2>,
584  {
585      let info = TestInfo {
586          num_iters: 100,
587          max_degree: None,
588          supported_degree: None,
589          num_polynomials: 1,
590          enforce_degree_bounds: true,
591          max_num_queries: 1,
592          ..Default::default()
593      };
594      test_template::<E, S>(info)
595  }
596  
597  pub fn quadratic_poly_degree_bound_multiple_queries_test<E, S>() -> Result<Vec<TestComponents<E, S>>, PCError>
598  where
599      E: PairingEngine,
600      S: AlgebraicSponge<E::Fq, 2>,
601  {
602      let info = TestInfo {
603          num_iters: 100,
604          max_degree: Some(3),
605          supported_degree: Some(2),
606          num_polynomials: 1,
607          enforce_degree_bounds: true,
608          max_num_queries: 2,
609          ..Default::default()
610      };
611      test_template::<E, S>(info)
612  }
613  
614  pub fn single_poly_degree_bound_multiple_queries_test<E, S>() -> Result<Vec<TestComponents<E, S>>, PCError>
615  where
616      E: PairingEngine,
617      S: AlgebraicSponge<E::Fq, 2>,
618  {
619      let info = TestInfo {
620          num_iters: 100,
621          max_degree: None,
622          supported_degree: None,
623          num_polynomials: 1,
624          enforce_degree_bounds: true,
625          max_num_queries: 2,
626          ..Default::default()
627      };
628      test_template::<E, S>(info)
629  }
630  
631  pub fn two_polys_degree_bound_single_query_test<E, S>() -> Result<Vec<TestComponents<E, S>>, PCError>
632  where
633      E: PairingEngine,
634      S: AlgebraicSponge<E::Fq, 2>,
635  {
636      let info = TestInfo {
637          num_iters: 100,
638          max_degree: None,
639          supported_degree: None,
640          num_polynomials: 2,
641          enforce_degree_bounds: true,
642          max_num_queries: 1,
643          ..Default::default()
644      };
645      test_template::<E, S>(info)
646  }
647  
648  pub fn full_end_to_end_test<E, S>() -> Result<Vec<TestComponents<E, S>>, PCError>
649  where
650      E: PairingEngine,
651      S: AlgebraicSponge<E::Fq, 2>,
652  {
653      let info = TestInfo {
654          num_iters: 100,
655          max_degree: None,
656          supported_degree: None,
657          num_polynomials: 10,
658          enforce_degree_bounds: true,
659          max_num_queries: 5,
660          ..Default::default()
661      };
662      test_template::<E, S>(info)
663  }
664  
665  pub fn full_end_to_end_equation_test<E, S>() -> Result<Vec<TestComponents<E, S>>, PCError>
666  where
667      E: PairingEngine,
668      S: AlgebraicSponge<E::Fq, 2>,
669  {
670      let info = TestInfo {
671          num_iters: 100,
672          max_degree: None,
673          supported_degree: None,
674          num_polynomials: 10,
675          enforce_degree_bounds: true,
676          max_num_queries: 5,
677          num_equations: Some(10),
678      };
679      equation_test_template::<E, S>(info)
680  }
681  
682  pub fn single_equation_test<E, S>() -> Result<Vec<TestComponents<E, S>>, PCError>
683  where
684      E: PairingEngine,
685      S: AlgebraicSponge<E::Fq, 2>,
686  {
687      let info = TestInfo {
688          num_iters: 100,
689          max_degree: None,
690          supported_degree: None,
691          num_polynomials: 1,
692          enforce_degree_bounds: false,
693          max_num_queries: 1,
694          num_equations: Some(1),
695      };
696      equation_test_template::<E, S>(info)
697  }
698  
699  pub fn two_equation_test<E, S>() -> Result<Vec<TestComponents<E, S>>, PCError>
700  where
701      E: PairingEngine,
702      S: AlgebraicSponge<E::Fq, 2>,
703  {
704      let info = TestInfo {
705          num_iters: 100,
706          max_degree: None,
707          supported_degree: None,
708          num_polynomials: 2,
709          enforce_degree_bounds: false,
710          max_num_queries: 1,
711          num_equations: Some(2),
712      };
713      equation_test_template::<E, S>(info)
714  }
715  
716  pub fn two_equation_degree_bound_test<E, S>() -> Result<Vec<TestComponents<E, S>>, PCError>
717  where
718      E: PairingEngine,
719      S: AlgebraicSponge<E::Fq, 2>,
720  {
721      let info = TestInfo {
722          num_iters: 100,
723          max_degree: None,
724          supported_degree: None,
725          num_polynomials: 2,
726          enforce_degree_bounds: true,
727          max_num_queries: 1,
728          num_equations: Some(2),
729      };
730      equation_test_template::<E, S>(info)
731  }