Skip to content

Commit 46da97a

Browse files
committed
Address Facundo's commend
1 parent d5a0cd2 commit 46da97a

File tree

7 files changed

+17
-15
lines changed

7 files changed

+17
-15
lines changed

barretenberg/cpp/src/barretenberg/vm2/avm_api.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ std::pair<AvmAPI::AvmProof, AvmAPI::AvmVerificationKey> AvmAPI::prove(const AvmA
2626
// Prove.
2727
info("Proving...");
2828
AvmProvingHelper proving_helper;
29-
auto [proof, vk] =
30-
AVM_TRACK_TIME_V("proving/all", proving_helper.prove(std::move(trace), inputs.publicInputs.to_columns()));
29+
auto [proof, vk] = AVM_TRACK_TIME_V("proving/all", proving_helper.prove(std::move(trace)));
3130

3231
info("Done!");
3332
return { std::move(proof), std::move(vk) };

barretenberg/cpp/src/barretenberg/vm2/constraining/prover.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,18 @@ void AvmProver::execute_preamble_round()
5050
* @brief Add public inputs to transcript
5151
*
5252
*/
53-
void AvmProver::execute_public_inputs_round(const std::vector<std::vector<FF>>& public_inputs_cols)
53+
void AvmProver::execute_public_inputs_round()
5454
{
55+
// We take the starting values of the public inputs polynomials to add to the transcript
56+
const auto public_inputs_cols = std::vector({ &prover_polynomials.public_inputs_cols_0_,
57+
&prover_polynomials.public_inputs_cols_1_,
58+
&prover_polynomials.public_inputs_cols_2_,
59+
&prover_polynomials.public_inputs_cols_3_ });
5560
for (size_t i = 0; i < public_inputs_cols.size(); ++i) {
5661
for (size_t j = 0; j < AVM_PUBLIC_INPUTS_COLUMNS_MAX_LENGTH; ++j) {
5762
// The public inputs are added to the hash buffer, but do not increase the size of the proof
5863
transcript->add_to_hash_buffer("public_input_" + std::to_string(i) + "_" + std::to_string(j),
59-
j < public_inputs_cols[i].size() ? public_inputs_cols[i][j] : FF(0));
64+
j < public_inputs_cols[i]->size() ? public_inputs_cols[i]->at(j) : FF(0));
6065
}
6166
}
6267
}
@@ -155,13 +160,13 @@ HonkProof AvmProver::export_proof()
155160
return transcript->export_proof();
156161
}
157162

158-
HonkProof AvmProver::construct_proof(const std::vector<std::vector<FF>>& public_inputs_cols)
163+
HonkProof AvmProver::construct_proof()
159164
{
160165
// Add circuit size public input size and public inputs to transcript.
161166
execute_preamble_round();
162167

163168
// Add public inputs to transcript.
164-
AVM_TRACK_TIME("prove/public_inputs_round", execute_public_inputs_round(public_inputs_cols));
169+
AVM_TRACK_TIME("prove/public_inputs_round", execute_public_inputs_round());
165170

166171
// Compute wire commitments.
167172
AVM_TRACK_TIME("prove/wire_commitments_round", execute_wire_commitments_round());

barretenberg/cpp/src/barretenberg/vm2/constraining/prover.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ class AvmProver {
3131
// Note: all the following methods are virtual to allow Avm2 to tweak the behaviour.
3232
// We can remove this once the transition is done.
3333
virtual void execute_preamble_round();
34-
virtual void execute_public_inputs_round(const std::vector<std::vector<FF>>& public_inputs_cols);
34+
virtual void execute_public_inputs_round();
3535
virtual void execute_wire_commitments_round();
3636
virtual void execute_log_derivative_inverse_round();
3737
virtual void execute_log_derivative_inverse_commitments_round();
3838
virtual void execute_relation_check_rounds();
3939
virtual void execute_pcs_rounds();
4040

4141
virtual HonkProof export_proof();
42-
virtual HonkProof construct_proof(const std::vector<std::vector<FF>>& public_inputs_cols);
42+
virtual HonkProof construct_proof();
4343

4444
std::shared_ptr<Transcript> transcript = std::make_shared<Transcript>();
4545

barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_verifier.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class AvmRecursiveTests : public ::testing::Test {
4444
const auto public_inputs_cols = public_inputs.to_columns();
4545

4646
InnerProver prover;
47-
const auto [proof, vk_data] = prover.prove(std::move(trace), public_inputs_cols);
47+
const auto [proof, vk_data] = prover.prove(std::move(trace));
4848
const auto verification_key = InnerProver::create_verification_key(vk_data);
4949
InnerVerifier verifier(verification_key);
5050

barretenberg/cpp/src/barretenberg/vm2/constraining/verifier.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AvmVerifierTests : public ::testing::Test {
3030

3131
Prover prover;
3232
auto public_inputs_cols = public_inputs.to_columns();
33-
const auto [proof, vk_data] = prover.prove(std::move(trace), public_inputs_cols);
33+
const auto [proof, vk_data] = prover.prove(std::move(trace));
3434
const auto verification_key = prover.create_verification_key(vk_data);
3535

3636
return { proof, verification_key, public_inputs_cols };

barretenberg/cpp/src/barretenberg/vm2/proving_helper.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ std::shared_ptr<AvmVerifier::VerificationKey> AvmProvingHelper::create_verificat
5555
return std::make_shared<VerificationKey>(precomputed_cmts);
5656
}
5757

58-
std::pair<AvmProvingHelper::Proof, AvmProvingHelper::VkData> AvmProvingHelper::prove(
59-
tracegen::TraceContainer&& trace, const std::vector<std::vector<FF>>& public_inputs_cols)
58+
std::pair<AvmProvingHelper::Proof, AvmProvingHelper::VkData> AvmProvingHelper::prove(tracegen::TraceContainer&& trace)
6059
{
6160
auto polynomials = AVM_TRACK_TIME_V("proving/prove:compute_polynomials", constraining::compute_polynomials(trace));
6261
auto proving_key = AVM_TRACK_TIME_V("proving/prove:proving_key", create_proving_key(polynomials));
@@ -66,7 +65,7 @@ std::pair<AvmProvingHelper::Proof, AvmProvingHelper::VkData> AvmProvingHelper::p
6665
auto prover = AVM_TRACK_TIME_V("proving/prove:construct_prover",
6766
AvmProver(proving_key, verification_key, proving_key->commitment_key));
6867

69-
auto proof = AVM_TRACK_TIME_V("proving/construct_proof", prover.construct_proof(public_inputs_cols));
68+
auto proof = AVM_TRACK_TIME_V("proving/construct_proof", prover.construct_proof());
7069
auto serialized_vk = to_buffer(verification_key->to_field_elements());
7170

7271
return { std::move(proof), std::move(serialized_vk) };

barretenberg/cpp/src/barretenberg/vm2/proving_helper.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ class AvmProvingHelper {
1515
using VkData = std::vector<uint8_t>;
1616

1717
static std::shared_ptr<AvmVerifier::VerificationKey> create_verification_key(const VkData& vk_data);
18-
std::pair<Proof, VkData> prove(tracegen::TraceContainer&& trace,
19-
const std::vector<std::vector<FF>>& public_inputs_cols);
18+
std::pair<Proof, VkData> prove(tracegen::TraceContainer&& trace);
2019
bool check_circuit(tracegen::TraceContainer&& trace);
2120
bool verify(const Proof& proof, const PublicInputs& pi, const VkData& vk_data);
2221
};

0 commit comments

Comments
 (0)