Skip to content

Commit

Permalink
update zero evaluation and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ledwards2225 committed Sep 5, 2023
1 parent 9abfd42 commit 05e872f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,8 @@ template <typename Curve, bool goblin_flag = false> class KZG {
std::vector<GroupElement> commitments = { claim.commitment, quotient_commitment };
std::vector<Fr> scalars = { one, claim.opening_pair.challenge };
P_0 = GroupElement::template batch_mul<goblin_flag>(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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ template <typename Curve, bool goblin_flag = false> class ShplonkVerifier_ {
auto Q_commitment = transcript.template receive_from_prover<Commitment>("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ⱼ )]
Expand All @@ -192,7 +191,6 @@ template <typename Curve, bool goblin_flag = false> 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<Commitment> commitments;
Expand Down Expand Up @@ -236,8 +234,6 @@ template <typename Curve, bool goblin_flag = false> class ShplonkVerifier_ {
G_commitment = GroupElement::template batch_mul<goblin_flag>(commitments, scalars);

} else {
evaluation_zero = Fr(0);

// [G] = [Q] - ∑ⱼ ρʲ / ( r − xⱼ )⋅[fⱼ] + G₀⋅[1]
// = [Q] - [∑ⱼ ρʲ ⋅ ( fⱼ(X) − vⱼ) / ( r − xⱼ )]
G_commitment = Q_commitment;
Expand Down Expand Up @@ -272,7 +268,7 @@ template <typename Curve, bool goblin_flag = false> 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

0 comments on commit 05e872f

Please sign in to comment.