From a0484c7be576bb79cf208cce5020784b68c9f836 Mon Sep 17 00:00:00 2001 From: sifnoc Date: Thu, 14 Mar 2024 09:09:16 +0000 Subject: [PATCH] fix: backend test; comment --- backend/src/tests.rs | 4 ++-- contracts/src/Summa.sol | 2 +- kzg_prover/benches/kzg.rs | 14 +------------- .../examples/chunked_univariate_grand_sum.rs | 1 - kzg_prover/src/utils/dummy_entries.rs | 2 -- 5 files changed, 4 insertions(+), 19 deletions(-) diff --git a/backend/src/tests.rs b/backend/src/tests.rs index 7d8a918c..4e081997 100644 --- a/backend/src/tests.rs +++ b/backend/src/tests.rs @@ -202,7 +202,7 @@ mod test { generate_setup_artifacts(K, Some(PARAMS_PATH), &univariate_grand_sum_circuit).unwrap(); // Create a proof - let instances = vec![Fp::one(); 1]; // This instance is necessary to verify proof on solidity verifier. + let instances = vec![Fp::zero(); 1]; // This instance is necessary to verify proof on solidity verifier. let (zk_snark_proof, advice_polys, _omega) = full_prover( ¶ms, &pk, @@ -314,7 +314,7 @@ mod test { generate_setup_artifacts(K, Some(PARAMS_PATH), &univariate_grand_sum_circuit).unwrap(); // Create a SNARK proof - let instances = vec![Fp::one(); 1]; // This instance is necessary to verify proof on solidity verifier. + let instances = vec![Fp::zero(); 1]; // This instance is necessary to verify proof on solidity verifier. let (zk_snark_proof, advice_polys, _omega) = full_prover( ¶ms, &pk, diff --git a/contracts/src/Summa.sol b/contracts/src/Summa.sol index a8138b97..06602cbb 100644 --- a/contracts/src/Summa.sol +++ b/contracts/src/Summa.sol @@ -143,7 +143,7 @@ contract Summa is Ownable { uint8 balanceByteRange ) internal view returns (bool isValid) { // The number of permutations is 2 + (balanceByteRange/2) * numberOfCurrencies because of the circuit structure: - // 1 per instance column, 1 per constant column (range check) and balanceByteRange/2 per range check columns times the number of currencies + // 1 per instance column, 1 per constant column (range check) and (balanceByteRange/2) + 1 per range check columns times the number of currencies uint256 numPermutations = 2 + ((balanceByteRange / 2) + 1) * numberOfCurrencies; diff --git a/kzg_prover/benches/kzg.rs b/kzg_prover/benches/kzg.rs index a8ae0ca4..7ef71e48 100644 --- a/kzg_prover/benches/kzg.rs +++ b/kzg_prover/benches/kzg.rs @@ -264,21 +264,9 @@ fn criterion_benchmark(_c: &mut Criterion) { // Demonstrating that a higher value of K has a more significant impact on benchmark performance than the number of users #[cfg(not(feature = "no_range_check"))] - { - const K: u32 = 18; - const N_USERS: usize = (1 << K) - 6; - bench_kzg::< - K, - N_USERS, - N_CURRENCIES, - N_POINTS, - UnivariateGrandSumConfig, - >(format!("K = {K}, N_USERS = {N_USERS}, N_CURRENCIES = {N_CURRENCIES}").as_str()); - } - #[cfg(not(feature = "no_range_check"))] { const K: u32 = 17; - const N_USERS: usize = (1 << K) - 6; + const N_USERS: usize = 2usize.pow(K) - 6; bench_kzg::< K, N_USERS, diff --git a/kzg_prover/examples/chunked_univariate_grand_sum.rs b/kzg_prover/examples/chunked_univariate_grand_sum.rs index bc5c4f7b..4ca6dc99 100644 --- a/kzg_prover/examples/chunked_univariate_grand_sum.rs +++ b/kzg_prover/examples/chunked_univariate_grand_sum.rs @@ -2,7 +2,6 @@ use std::error::Error; use halo2_proofs::halo2curves::bn256::{Fr as Fp, G1Affine}; -use halo2_proofs::halo2curves::group::cofactor::CofactorCurveAffine; use halo2_proofs::halo2curves::group::Curve; use halo2_proofs::transcript::TranscriptRead; use halo2_proofs::{ diff --git a/kzg_prover/src/utils/dummy_entries.rs b/kzg_prover/src/utils/dummy_entries.rs index c01d74dc..69151e05 100644 --- a/kzg_prover/src/utils/dummy_entries.rs +++ b/kzg_prover/src/utils/dummy_entries.rs @@ -33,8 +33,6 @@ pub fn generate_dummy_entries(/ #[cfg(test)] mod tests { use super::*; - use crate::cryptocurrency::Cryptocurrency; - use crate::entry::Entry; #[test] fn test_generate_random_entries() {