From b7ae15576ffa41eee90f8072f7053760d6eeab6f Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Tue, 5 Sep 2023 19:26:03 +0000 Subject: [PATCH] update zero evaluation and comments --- .../cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp | 9 ++------- .../cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp | 6 +----- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp index 99bbda063bdc..ab2c8d8bb7a2 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp @@ -89,13 +89,8 @@ template class KZG { std::vector commitments = { claim.commitment, quotient_commitment }; std::vector scalars = { one, claim.opening_pair.challenge }; P_0 = GroupElement::template batch_mul(commitments, scalars); - // WORKTODO(luke): The evaluation is always zero due to the nature of shplonk. What is the proper way to - // handle this? Contraints to show scalar (evaluation) is zero? Or simply dont add anything and ensure this - // function is only used in the current context? - // if (!claim.opening_pair.evaluation.get_value().is_zero()) { - // auto ctx = verifier_transcript.builder; - // lhs -= GroupElement::one(ctx) * claim.opening_pair.evaluation; - // } + // Note: This implementation assumes the evaluation is zero (as is the case for shplonk). + ASSERT(claim.opening_pair.evaluation.get_value() == 0); } else { P_0 = claim.commitment; P_0 += quotient_commitment * claim.opening_pair.challenge; diff --git a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp index f53925af24e1..17c452471dcf 100644 --- a/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp +++ b/circuits/cpp/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp @@ -173,7 +173,6 @@ template class ShplonkVerifier_ { auto Q_commitment = transcript.template receive_from_prover("Shplonk:Q"); const Fr z_challenge = transcript.get_challenge("Shplonk:z"); - Fr evaluation_zero; // 0 \in Fr // [G] = [Q] - ∑ⱼ ρʲ / ( r − xⱼ )⋅[fⱼ] + G₀⋅[1] // = [Q] - [∑ⱼ ρʲ ⋅ ( fⱼ(X) − vⱼ) / ( r − xⱼ )] @@ -192,7 +191,6 @@ template class ShplonkVerifier_ { // using a builder Simulator. if constexpr (Curve::is_stdlib_type) { auto builder = nu.get_context(); - evaluation_zero = Fr(builder, 0); // Containers for the inputs to the final batch mul std::vector commitments; @@ -236,8 +234,6 @@ template class ShplonkVerifier_ { G_commitment = GroupElement::template batch_mul(commitments, scalars); } else { - evaluation_zero = Fr(0); - // [G] = [Q] - ∑ⱼ ρʲ / ( r − xⱼ )⋅[fⱼ] + G₀⋅[1] // = [Q] - [∑ⱼ ρʲ ⋅ ( fⱼ(X) − vⱼ) / ( r − xⱼ )] G_commitment = Q_commitment; @@ -272,7 +268,7 @@ template class ShplonkVerifier_ { } // Return opening pair (z, 0) and commitment [G] - return { { z_challenge, evaluation_zero }, G_commitment }; + return { { z_challenge, Fr(0) }, G_commitment }; }; }; } // namespace proof_system::honk::pcs::shplonk