Skip to content

Commit c6633d8

Browse files
iakovenkosRumata888
authored andcommitted
chore: removing hack commitment from eccvm (#8825)
* removed hack commitment from eccvm
1 parent 4b7f89e commit c6633d8

File tree

5 files changed

+34
-57
lines changed

5 files changed

+34
-57
lines changed

barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp

-8
Original file line numberDiff line numberDiff line change
@@ -937,13 +937,11 @@ class ECCVMFlavor {
937937
std::array<FF, NUM_ALL_ENTITIES> sumcheck_evaluations;
938938
std::vector<Commitment> zm_cq_comms;
939939
Commitment zm_cq_comm;
940-
Commitment translation_hack_comm;
941940
FF translation_eval_op;
942941
FF translation_eval_px;
943942
FF translation_eval_py;
944943
FF translation_eval_z1;
945944
FF translation_eval_z2;
946-
FF hack_eval;
947945
Commitment shplonk_q_comm;
948946
uint32_t ipa_poly_degree;
949947
std::vector<Commitment> ipa_l_comms;
@@ -1151,8 +1149,6 @@ class ECCVMFlavor {
11511149
}
11521150
zm_cq_comm = NativeTranscript::template deserialize_from_buffer<Commitment>(proof_data, num_frs_read);
11531151

1154-
translation_hack_comm = NativeTranscript::template deserialize_from_buffer<Commitment>(
1155-
NativeTranscript::proof_data, num_frs_read);
11561152
translation_eval_op =
11571153
NativeTranscript::template deserialize_from_buffer<FF>(NativeTranscript::proof_data, num_frs_read);
11581154
translation_eval_px =
@@ -1163,8 +1159,6 @@ class ECCVMFlavor {
11631159
NativeTranscript::template deserialize_from_buffer<FF>(NativeTranscript::proof_data, num_frs_read);
11641160
translation_eval_z2 =
11651161
NativeTranscript::template deserialize_from_buffer<FF>(NativeTranscript::proof_data, num_frs_read);
1166-
hack_eval =
1167-
NativeTranscript::template deserialize_from_buffer<FF>(NativeTranscript::proof_data, num_frs_read);
11681162

11691163
shplonk_q_comm = NativeTranscript::template deserialize_from_buffer<Commitment>(proof_data, num_frs_read);
11701164

@@ -1297,13 +1291,11 @@ class ECCVMFlavor {
12971291
}
12981292
NativeTranscript::template serialize_to_buffer(zm_cq_comm, NativeTranscript::proof_data);
12991293

1300-
NativeTranscript::template serialize_to_buffer(translation_hack_comm, NativeTranscript::proof_data);
13011294
NativeTranscript::template serialize_to_buffer(translation_eval_op, NativeTranscript::proof_data);
13021295
NativeTranscript::template serialize_to_buffer(translation_eval_px, NativeTranscript::proof_data);
13031296
NativeTranscript::template serialize_to_buffer(translation_eval_py, NativeTranscript::proof_data);
13041297
NativeTranscript::template serialize_to_buffer(translation_eval_z1, NativeTranscript::proof_data);
13051298
NativeTranscript::template serialize_to_buffer(translation_eval_z2, NativeTranscript::proof_data);
1306-
NativeTranscript::template serialize_to_buffer(hack_eval, NativeTranscript::proof_data);
13071299

13081300
NativeTranscript::template serialize_to_buffer(shplonk_q_comm, NativeTranscript::proof_data);
13091301

barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.cpp

+10-20
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,6 @@ void ECCVMProver::execute_pcs_rounds()
129129
commitment_key,
130130
transcript);
131131

132-
// Batch open the transcript polynomials as univariates for Translator consistency check. Since IPA cannot
133-
// currently handle polynomials for which the latter half of the coefficients are 0, we hackily
134-
// batch the constant polynomial 1 in with the 5 transcript polynomials.
135-
// TODO(https://github.com/AztecProtocol/barretenberg/issues/768): fix IPA to avoid the need for the hack polynomial
136-
Polynomial hack(key->circuit_size);
137-
for (size_t idx = 0; idx < key->circuit_size; idx++) {
138-
hack.at(idx) = 1;
139-
}
140-
transcript->send_to_verifier("Translation:hack_commitment", commitment_key->commit(hack));
141-
142132
// Get the challenge at which we evaluate all transcript polynomials as univariates
143133
evaluation_challenge_x = transcript->template get_challenge<FF>("Translation:evaluation_challenge_x");
144134

@@ -156,20 +146,20 @@ void ECCVMProver::execute_pcs_rounds()
156146
transcript->send_to_verifier("Translation:z1", translation_evaluations.z1);
157147
transcript->send_to_verifier("Translation:z2", translation_evaluations.z2);
158148

159-
FF hack_evaluation = hack.evaluate(evaluation_challenge_x);
160-
transcript->send_to_verifier("Translation:hack_evaluation", hack_evaluation);
161-
162149
// Get another challenge for batching the univariates and evaluations
163150
FF ipa_batching_challenge = transcript->template get_challenge<FF>("Translation:ipa_batching_challenge");
164151

165152
// Collect the polynomials and evaluations to be batched
166-
RefArray univariate_polynomials{ key->polynomials.transcript_op, key->polynomials.transcript_Px,
167-
key->polynomials.transcript_Py, key->polynomials.transcript_z1,
168-
key->polynomials.transcript_z2, hack };
169-
std::array<FF, univariate_polynomials.size()> univariate_evaluations{
170-
translation_evaluations.op, translation_evaluations.Px, translation_evaluations.Py,
171-
translation_evaluations.z1, translation_evaluations.z2, hack_evaluation
172-
};
153+
RefArray univariate_polynomials{ key->polynomials.transcript_op,
154+
key->polynomials.transcript_Px,
155+
key->polynomials.transcript_Py,
156+
key->polynomials.transcript_z1,
157+
key->polynomials.transcript_z2 };
158+
std::array<FF, univariate_polynomials.size()> univariate_evaluations{ translation_evaluations.op,
159+
translation_evaluations.Px,
160+
translation_evaluations.Py,
161+
translation_evaluations.z1,
162+
translation_evaluations.z2 };
173163

174164
// Construct the batched polynomial and batched evaluation to produce the batched opening claim
175165
Polynomial batched_univariate{ key->circuit_size };

barretenberg/cpp/src/barretenberg/eccvm/eccvm_transcript.test.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ class ECCVMTranscriptTests : public ::testing::Test {
162162
manifest_expected.add_challenge(round, "ZM:x", "ZM:z");
163163

164164
round++;
165-
manifest_expected.add_entry(round, "Translation:hack_commitment", frs_per_G);
166165
manifest_expected.add_challenge(round, "Translation:evaluation_challenge_x");
167166

168167
round++;
@@ -171,7 +170,6 @@ class ECCVMTranscriptTests : public ::testing::Test {
171170
manifest_expected.add_entry(round, "Translation:Py", frs_per_Fr);
172171
manifest_expected.add_entry(round, "Translation:z1", frs_per_Fr);
173172
manifest_expected.add_entry(round, "Translation:z2", frs_per_Fr);
174-
manifest_expected.add_entry(round, "Translation:hack_evaluation", frs_per_Fr);
175173
manifest_expected.add_challenge(round, "Translation:ipa_batching_challenge");
176174

177175
round++;

barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.cpp

+13-15
Original file line numberDiff line numberDiff line change
@@ -69,35 +69,33 @@ bool ECCVMVerifier::verify_proof(const HonkProof& proof)
6969
multivariate_challenge,
7070
key->pcs_verification_key->get_g1_identity(),
7171
transcript);
72-
7372
// Execute transcript consistency univariate opening round
74-
auto hack_commitment = transcript->template receive_from_prover<Commitment>("Translation:hack_commitment");
7573

76-
FF evaluation_challenge_x = transcript->template get_challenge<FF>("Translation:evaluation_challenge_x");
74+
const FF evaluation_challenge_x = transcript->template get_challenge<FF>("Translation:evaluation_challenge_x");
7775

7876
// Construct arrays of commitments and evaluations to be batched, the evaluations being received from the prover
79-
const size_t NUM_UNIVARIATES = 6;
80-
std::array<Commitment, NUM_UNIVARIATES> transcript_commitments = {
81-
commitments.transcript_op, commitments.transcript_Px, commitments.transcript_Py,
82-
commitments.transcript_z1, commitments.transcript_z2, hack_commitment
83-
};
77+
const size_t NUM_UNIVARIATES = 5;
78+
std::array<Commitment, NUM_UNIVARIATES> transcript_commitments = { commitments.transcript_op,
79+
commitments.transcript_Px,
80+
commitments.transcript_Py,
81+
commitments.transcript_z1,
82+
commitments.transcript_z2 };
8483
std::array<FF, NUM_UNIVARIATES> transcript_evaluations = {
8584
transcript->template receive_from_prover<FF>("Translation:op"),
8685
transcript->template receive_from_prover<FF>("Translation:Px"),
8786
transcript->template receive_from_prover<FF>("Translation:Py"),
8887
transcript->template receive_from_prover<FF>("Translation:z1"),
89-
transcript->template receive_from_prover<FF>("Translation:z2"),
90-
transcript->template receive_from_prover<FF>("Translation:hack_evaluation")
88+
transcript->template receive_from_prover<FF>("Translation:z2")
9189
};
9290

9391
// Get the batching challenge for commitments and evaluations
94-
FF ipa_batching_challenge = transcript->template get_challenge<FF>("Translation:ipa_batching_challenge");
92+
const FF ipa_batching_challenge = transcript->template get_challenge<FF>("Translation:ipa_batching_challenge");
9593

9694
// Compute the batched commitment and batched evaluation for the univariate opening claim
97-
auto batched_commitment = transcript_commitments[0];
98-
auto batched_transcript_eval = transcript_evaluations[0];
99-
auto batching_scalar = ipa_batching_challenge;
100-
for (size_t idx = 1; idx < transcript_commitments.size(); ++idx) {
95+
Commitment batched_commitment = transcript_commitments[0];
96+
FF batched_transcript_eval = transcript_evaluations[0];
97+
FF batching_scalar = ipa_batching_challenge;
98+
for (size_t idx = 1; idx < NUM_UNIVARIATES; ++idx) {
10199
batched_commitment = batched_commitment + transcript_commitments[idx] * batching_scalar;
102100
batched_transcript_eval += batching_scalar * transcript_evaluations[idx];
103101
batching_scalar *= ipa_batching_challenge;

barretenberg/cpp/src/barretenberg/stdlib/eccvm_verifier/eccvm_recursive_verifier.cpp

+11-12
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ template <typename Flavor> void ECCVMRecursiveVerifier_<Flavor>::verify_proof(co
4040
}
4141

4242
// Get challenge for sorted list batching and wire four memory records
43-
auto [beta, gamma] = transcript->template get_challenges<FF>("beta", "gamma");
43+
const auto [beta, gamma] = transcript->template get_challenges<FF>("beta", "gamma");
4444

4545
auto beta_sqr = beta * beta;
4646

@@ -63,7 +63,7 @@ template <typename Flavor> void ECCVMRecursiveVerifier_<Flavor>::verify_proof(co
6363
// sumcheck is dependent on circuit size.
6464
const size_t log_circuit_size = numeric::get_msb(static_cast<uint32_t>(circuit_size.get_value()));
6565
auto sumcheck = SumcheckVerifier<Flavor>(log_circuit_size, transcript, FF(0));
66-
FF alpha = transcript->template get_challenge<FF>("Sumcheck:alpha");
66+
const FF alpha = transcript->template get_challenge<FF>("Sumcheck:alpha");
6767
std::vector<FF> gate_challenges(static_cast<size_t>(numeric::get_msb(key->circuit_size)));
6868
for (size_t idx = 0; idx < gate_challenges.size(); idx++) {
6969
gate_challenges[idx] = transcript->template get_challenge<FF>("Sumcheck:gate_challenge_" + std::to_string(idx));
@@ -80,25 +80,24 @@ template <typename Flavor> void ECCVMRecursiveVerifier_<Flavor>::verify_proof(co
8080
multivariate_challenge,
8181
key->pcs_verification_key->get_g1_identity(),
8282
transcript);
83-
auto hack_commitment = transcript->template receive_from_prover<Commitment>("Translation:hack_commitment");
8483

85-
FF evaluation_challenge_x = transcript->template get_challenge<FF>("Translation:evaluation_challenge_x");
84+
const FF evaluation_challenge_x = transcript->template get_challenge<FF>("Translation:evaluation_challenge_x");
8685

8786
// Construct the vector of commitments (needs to be vector for the batch_mul) and array of evaluations to be batched
88-
std::vector<Commitment> transcript_commitments = { commitments.transcript_op, commitments.transcript_Px,
89-
commitments.transcript_Py, commitments.transcript_z1,
90-
commitments.transcript_z2, hack_commitment };
87+
std::vector<Commitment> transcript_commitments = { commitments.transcript_op,
88+
commitments.transcript_Px,
89+
commitments.transcript_Py,
90+
commitments.transcript_z1,
91+
commitments.transcript_z2 };
9192

9293
std::vector<FF> transcript_evaluations = { transcript->template receive_from_prover<FF>("Translation:op"),
9394
transcript->template receive_from_prover<FF>("Translation:Px"),
9495
transcript->template receive_from_prover<FF>("Translation:Py"),
9596
transcript->template receive_from_prover<FF>("Translation:z1"),
96-
transcript->template receive_from_prover<FF>("Translation:z2"),
97-
transcript->template receive_from_prover<FF>(
98-
"Translation:hack_evaluation") };
97+
transcript->template receive_from_prover<FF>("Translation:z2") };
9998

10099
// Get the batching challenge for commitments and evaluations
101-
FF ipa_batching_challenge = transcript->template get_challenge<FF>("Translation:ipa_batching_challenge");
100+
const FF ipa_batching_challenge = transcript->template get_challenge<FF>("Translation:ipa_batching_challenge");
102101

103102
// Compute the batched commitment and batched evaluation for the univariate opening claim
104103
auto batched_transcript_eval = transcript_evaluations[0];
@@ -110,7 +109,7 @@ template <typename Flavor> void ECCVMRecursiveVerifier_<Flavor>::verify_proof(co
110109
batching_challenges.emplace_back(batching_scalar);
111110
batching_scalar *= ipa_batching_challenge;
112111
}
113-
auto batched_commitment = Commitment::batch_mul(transcript_commitments, batching_challenges);
112+
const Commitment batched_commitment = Commitment::batch_mul(transcript_commitments, batching_challenges);
114113

115114
// Construct and verify the combined opening claim
116115
OpeningClaim<Curve> batched_univariate_claim = { { evaluation_challenge_x, batched_transcript_eval },

0 commit comments

Comments
 (0)