From b454b3580de3dddaed1b93be20c0ea84946f289c Mon Sep 17 00:00:00 2001 From: Aaron Feickert <66188213+AaronFeickert@users.noreply.github.com> Date: Thu, 15 Jul 2021 13:09:23 -0400 Subject: [PATCH] Simplify types --- src/liblelantus/sigmaextended_prover.cpp | 4 ++-- src/liblelantus/sigmaextended_verifier.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/liblelantus/sigmaextended_prover.cpp b/src/liblelantus/sigmaextended_prover.cpp index 5d12ecf77e..0c8db5b86f 100644 --- a/src/liblelantus/sigmaextended_prover.cpp +++ b/src/liblelantus/sigmaextended_prover.cpp @@ -128,9 +128,9 @@ void SigmaExtendedProver::sigma_commit( std::vector> partial_p_s; // Pre-calculate product parts and calculate p_s(x) at the same time, put the latter into p_i_sum - for (std::size_t j = m_; j > 0; j--) { + for (std::ptrdiff_t j = m_ - 1; j >= 0; j--) { partial_p_s.push_back(p_i_sum); - LelantusPrimitives::new_factor(sigma[(j - 1) * n_ + I[j - 1]], a[(j - 1) * n_ + I[j - 1]], p_i_sum); + LelantusPrimitives::new_factor(sigma[j*n_ + I[j]], a[j*n_ + I[j]], p_i_sum); } for (std::size_t j = 0; j < m_; j++) { diff --git a/src/liblelantus/sigmaextended_verifier.cpp b/src/liblelantus/sigmaextended_verifier.cpp index b8aefb54fa..46dcceeb08 100644 --- a/src/liblelantus/sigmaextended_verifier.cpp +++ b/src/liblelantus/sigmaextended_verifier.cpp @@ -43,7 +43,7 @@ bool SigmaExtendedVerifier::singleverify( const std::vector& commits, const Scalar& x, const Scalar& serial, - const size_t setSize, + const std::size_t setSize, const SigmaExtendedProof& proof) const { std::vector challenges = { x }; std::vector serials = { serial }; @@ -88,7 +88,7 @@ bool SigmaExtendedVerifier::batchverify( const std::vector& commits, const std::vector& challenges, const std::vector& serials, - const std::vector& setSizes, + const std::vector& setSizes, const std::vector& proofs) const { return verify( @@ -107,7 +107,7 @@ bool SigmaExtendedVerifier::verify( const std::vector& commits, const std::vector& challenges, const std::vector& serials, - const std::vector& setSizes, + const std::vector& setSizes, const bool commonChallenge, const bool specifiedSetSizes, const std::vector& proofs) const { @@ -164,7 +164,7 @@ bool SigmaExtendedVerifier::verify( std::vector commit_scalars; // associated to commitment list h_scalars.reserve(n * m); h_scalars.resize(n * m); - for (size_t i = 0; i < n * m; i++) { + for (std::size_t i = 0; i < n * m; i++) { h_scalars[i] = Scalar(uint64_t(0)); } commit_scalars.reserve(commits.size()); @@ -259,9 +259,9 @@ bool SigmaExtendedVerifier::verify( Scalar pow(uint64_t(1)); std::vector f_part_product; - for (std::size_t j = m; j > 0; j--) { + for (std::ptrdiff_t j = m - 1; j >= 0; j--) { f_part_product.push_back(pow); - pow *= f_[(j - 1) * n + I_[setSize - 1][j - 1]]; + pow *= f_[j*n + I_[setSize - 1][j]]; } NthPower xj(x); @@ -426,7 +426,7 @@ void SigmaExtendedVerifier::compute_batch_fis( Scalar t; - for (int i = 0; i < n; i++) + for (std::size_t i = 0; i < n; i++) { t = f[j * n + i]; t *= f_i;