diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/relation_correctness.test.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/relation_correctness.test.cpp index 2b9322ced97f..9b026d3c841e 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/relation_correctness.test.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/relation_correctness.test.cpp @@ -1,8 +1,10 @@ +#include "barretenberg/common/thread.hpp" #include "barretenberg/honk/proof_system/permutation_library.hpp" #include "barretenberg/plonk_honk_shared/library/grand_product_library.hpp" #include "barretenberg/translator_vm/translator_flavor.hpp" #include +#include using namespace bb; /** @@ -24,6 +26,9 @@ template void check_relation(auto circuit_s // Evaluate each constraint in the relation and check that each is satisfied Relation::accumulate(result, polynomials.get_row(i), params, 1); for (auto& element : result) { + if (element != 0) { + info(i); + } ASSERT_EQ(element, 0); } } @@ -311,8 +316,9 @@ TEST_F(TranslatorRelationCorrectnessTests, TranslatorExtraRelationsCorrectness) } // Fill in lagrange even polynomial - for (size_t i = 2; i < mini_circuit_size; i += 2) { - prover_polynomials.lagrange_even_in_minicircuit.at(i) = 1; + for (size_t i = 1; i < mini_circuit_size - 1; i += 2) { + prover_polynomials.lagrange_odd_in_minicircuit.at(i) = 1; + prover_polynomials.lagrange_even_in_minicircuit.at(i + 1) = 1; } constexpr size_t NUMBER_OF_POSSIBLE_OPCODES = 6; constexpr std::array possible_opcode_values = { 0, 1, 2, 3, 4, 8 }; @@ -323,6 +329,23 @@ TEST_F(TranslatorRelationCorrectnessTests, TranslatorExtraRelationsCorrectness) possible_opcode_values[static_cast(engine.get_random_uint8() % NUMBER_OF_POSSIBLE_OPCODES)]; } + std::unordered_set range_constraint_polynomial_ids; + for (auto& concatenation_group : prover_polynomial_ids.get_groups_to_be_concatenated()) { + for (auto& id : concatenation_group) { + range_constraint_polynomial_ids.insert(id); + } + } + + // Assign random values to the mini-circuit part of the range constraint polynomials + + for (const auto& range_constraint_polynomial_id : range_constraint_polynomial_ids) { + parallel_for_range(mini_circuit_size - 2, [&](size_t start, size_t end) { + // We want to iterate from 1 to mini_circuit_size - 2 (inclusive) + for (size_t i = start + 1; i < end + 1; i++) { + polynomial_container[range_constraint_polynomial_id].at(i) = fr::random_element(); + } + }); + } // Initialize used lagrange polynomials prover_polynomials.lagrange_second.at(1) = 1; prover_polynomials.lagrange_second_to_last_in_minicircuit.at(mini_circuit_size - 2) = 1; @@ -352,6 +375,9 @@ TEST_F(TranslatorRelationCorrectnessTests, TranslatorExtraRelationsCorrectness) // Check that Accumulator Transfer relation is satisfied across each row of the prover polynomials check_relation>(circuit_size, prover_polynomials, params); + + // Check that Zero Constraint relation is satisfied across each row of the prover polynomials + check_relation>(circuit_size, prover_polynomials, params); } /** * @brief Test the correctness of TranslatorFlavor's Decomposition Relation