From febfd7d38c84db83307d36f5c04c810e5fac1760 Mon Sep 17 00:00:00 2001 From: fcarreiro Date: Thu, 6 Mar 2025 12:29:35 +0000 Subject: [PATCH] fix(avm): use the correct number of rows in check_interaction --- .../vm2/constraining/testing/check_relation.hpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/testing/check_relation.hpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/testing/check_relation.hpp index 0ccca00153ae..d21b9736cfa5 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/testing/check_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/testing/check_relation.hpp @@ -27,13 +27,16 @@ template constexpr bool subrelation_is_linearly_independent( } template -void check_relation_internal(const Trace& trace, std::span subrelations, RowGetter get_row) +void check_relation_internal(const Trace& trace, + std::span subrelations, + uint32_t num_rows, + RowGetter get_row) { typename Relation::SumcheckArrayOfValuesOverSubrelations result{}; // Accumulate the trace over the subrelations and check the result // if the subrelation is linearly independent. - for (size_t r = 0; r < trace.size(); ++r) { + for (size_t r = 0; r < num_rows; ++r) { Relation::accumulate(result, get_row(trace, r), get_test_params(), 1); for (size_t j : subrelations) { if (subrelation_is_linearly_independent(j) && !result[j].is_zero()) { @@ -65,7 +68,7 @@ void check_relation(const tracegen::TestTraceContainer& trace, Ts... subrelation { std::array subrelations = { subrelation... }; detail::check_relation_internal( - trace.as_rows(), subrelations, [](const auto& trace, size_t r) { return trace.at(r); }); + trace.as_rows(), subrelations, trace.get_num_rows(), [](const auto& trace, size_t r) { return trace.at(r); }); } template void check_relation(const tracegen::TestTraceContainer& trace) @@ -93,8 +96,8 @@ template void check_interaction(const tracegen::TestTraceConta [&](std::index_sequence) { constexpr std::array subrels = { Is... }; detail::check_relation_internal( - polys, subrels, [](const auto& polys, size_t r) { return polys.get_row(r); }); + polys, subrels, num_rows, [](const auto& polys, size_t r) { return polys.get_row(r); }); }(std::make_index_sequence()); } -} // namespace bb::avm2::constraining \ No newline at end of file +} // namespace bb::avm2::constraining