Skip to content

Commit

Permalink
8714: Addressing review comments from Cody
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanmon committed Sep 27, 2024
1 parent b1877ba commit e6bdbfb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ AggregationObjectIndices create_avm_recursion_constraints(Builder& builder,
return result;
};

auto const proof_fields = fields_from_witnesses(input.proof);
auto const public_inputs_flattened = fields_from_witnesses(input.public_inputs);
const auto proof_fields = fields_from_witnesses(input.proof);
const auto public_inputs_flattened = fields_from_witnesses(input.public_inputs);

auto it = public_inputs_flattened.begin();
avm_trace::VmPublicInputs<field_ct> vm_public_inputs =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AcirAvmRecursionConstraint : public ::testing::Test {

static void SetUpTestSuite() { bb::srs::init_crs_factory("../srs_db/ignition"); }

static InnerBuilder create_inner_circuit(std::vector<FF> const& kernel_public_inputs_vec)
static InnerBuilder create_inner_circuit(const std::vector<FF>& kernel_public_inputs_vec)
{
auto public_inputs = convert_public_inputs(kernel_public_inputs_vec);
AvmTraceBuilder trace_builder(public_inputs);
Expand All @@ -65,7 +65,7 @@ class AcirAvmRecursionConstraint : public ::testing::Test {
* @brief Create a circuit that recursively verifies one or more inner avm circuits
*/
static OuterBuilder create_outer_circuit(std::vector<InnerBuilder>& inner_avm_circuits,
std::vector<FF> const& kernel_public_inputs_vec)
const std::vector<FF>& kernel_public_inputs_vec)
{
std::vector<RecursionConstraint> avm_recursion_constraints;

Expand Down
14 changes: 8 additions & 6 deletions barretenberg/cpp/src/barretenberg/polynomials/polynomial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ template <typename Fr> std::shared_ptr<Fr[]> _allocate_aligned_memory(size_t n_e
*/
template <typename Fr_>
Fr_ _evaluate_mle(std::span<const Fr_> evaluation_points,
SharedShiftedVirtualZeroesArray<Fr_> const& coefficients,
const SharedShiftedVirtualZeroesArray<Fr_>& coefficients,
bool shift)
{
constexpr bool is_native = IsAnyOf<Fr_, bb::fr, grumpkin::fr>;
Expand Down Expand Up @@ -413,11 +413,13 @@ Fr_ _evaluate_mle(std::span<const Fr_> evaluation_points,
}

Fr_ u_l = evaluation_points[0];

// Note below: i * 2 + 1 + offset might equal virtual_size. This used to subtlely be handled by extra capacity
// padding (and there used to be no assert time checks, which this constant helps with).
const size_t ALLOW_ONE_PAST_READ = 1;
for (size_t i = 0; i < n_l; ++i) {
// curr[i] = (Fr(1) - u_l) * prev[i * 2] + u_l * prev[(i * 2) + 1];
// Note: i * 2 + 1 + offset might equal virtual_size. This used to subtlely be handled by extra capacity padding
// (and there used to be no assert time checks, which this constant helps with).
const size_t ALLOW_ONE_PAST_READ = 1;

tmp[i] = coefficients.get(i * 2 + offset) +
u_l * (coefficients.get(i * 2 + 1 + offset, ALLOW_ONE_PAST_READ) - coefficients.get(i * 2 + offset));
}
Expand Down Expand Up @@ -445,12 +447,12 @@ Fr_ _evaluate_mle(std::span<const Fr_> evaluation_points,
*/
template <typename Fr_>
Fr_ generic_evaluate_mle(std::span<const Fr_> evaluation_points,
SharedShiftedVirtualZeroesArray<Fr_> const& coefficients)
const SharedShiftedVirtualZeroesArray<Fr_>& coefficients)
{
return _evaluate_mle(evaluation_points, coefficients, false);
}

template <typename Fr> inline std::ostream& operator<<(std::ostream& os, Polynomial<Fr> const& p)
template <typename Fr> inline std::ostream& operator<<(std::ostream& os, const Polynomial<Fr>& p)
{
if (p.size() == 0) {
return os << "[]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ AvmRecursiveVerifier_<Flavor>::AggregationObject AvmRecursiveVerifier_<Flavor>::
std::vector<std::vector<FF>> public_inputs_ct;
public_inputs_ct.reserve(public_inputs_vec_nt.size());

for (auto const& vec : public_inputs_vec_nt) {
for (const auto& vec : public_inputs_vec_nt) {
std::vector<FF> vec_ct;
vec_ct.reserve(vec.size());
for (auto const& el : vec) {
for (const auto& el : vec) {
vec_ct.push_back(bb::stdlib::witness_t<Builder>(builder, el));
}
public_inputs_ct.push_back(vec_ct);
Expand Down

0 comments on commit e6bdbfb

Please sign in to comment.