diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/address_derivation.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/address_derivation.test.cpp index 5ad343d8adf5..cbdc30704074 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/address_derivation.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/address_derivation.test.cpp @@ -157,17 +157,6 @@ TEST(AddressDerivationConstrainingTest, WithInteractions) LookupIntoDynamicTableSequential().process(trace); check_relation(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); } } // namespace diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bc_hashing.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bc_hashing.test.cpp index 8e67fc0de3aa..c9f9ac09a3bf 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bc_hashing.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bc_hashing.test.cpp @@ -97,7 +97,6 @@ TEST(BytecodeHashingConstrainingTest, PoseidonInteractions) tracegen::LookupIntoDynamicTableSequential().process(trace); check_relation(trace); - check_interaction(trace); } TEST(BytecodeHashingConstrainingTest, BytecodeInteractions) @@ -118,8 +117,6 @@ TEST(BytecodeHashingConstrainingTest, BytecodeInteractions) tracegen::LookupIntoDynamicTableSequential().process(trace); check_relation(trace); - check_interaction(trace); - check_interaction(trace); } TEST(BytecodeHashingConstrainingTest, NegativeInvalidStartAfterLatch) diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bitwise.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bitwise.test.cpp index 2e00af9c7dab..fde9aad9ccd1 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bitwise.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bitwise.test.cpp @@ -350,8 +350,6 @@ TEST(BitwiseConstrainingTest, MixedOperationsInteractions) LookupIntoIndexedByClk().process(trace); check_relation(trace); - check_interaction(trace); - check_interaction(trace); } } // namespace diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/class_id_derivation.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/class_id_derivation.test.cpp index f8e7ee08eed2..5d8f85d66130 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/class_id_derivation.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/class_id_derivation.test.cpp @@ -99,9 +99,6 @@ TEST(ClassIdDerivationConstrainingTest, WithHashInteraction) LookupIntoDynamicTableSequential().process(trace); LookupIntoDynamicTableSequential().process(trace); - - check_interaction(trace); - check_interaction(trace); } // TODO: This should probably be refined and moved to bc_retrieval test file once that exists @@ -139,7 +136,6 @@ TEST(ClassIdDerivationConstrainingTest, WithRetrievalInteraction) trace); LookupIntoDynamicTableSequential().process(trace); - check_interaction(trace); } } // namespace diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp index a4e5c9c248d3..9ae5018f4edc 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp @@ -564,12 +564,6 @@ TEST(ScalarMulConstrainingTest, MulInteractions) LookupIntoDynamicTableGeneric().process(trace); LookupIntoDynamicTableGeneric().process(trace); LookupIntoDynamicTableGeneric().process(trace); - - check_relation(trace); - check_relation(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); } TEST(ScalarMulConstrainingTest, MulAddInteractionsInfinity) @@ -597,8 +591,6 @@ TEST(ScalarMulConstrainingTest, MulAddInteractionsInfinity) check_relation(trace); check_relation(trace); - check_interaction(trace); - check_interaction(trace); } TEST(ScalarMulConstrainingTest, NegativeMulAddInteractions) @@ -625,12 +617,6 @@ TEST(ScalarMulConstrainingTest, NegativeMulAddInteractions) "Failed.*SCALAR_MUL_DOUBLE. Could not find tuple in destination."); EXPECT_THROW_WITH_MESSAGE(LookupIntoDynamicTableGeneric().process(trace), "Failed.*SCALAR_MUL_ADD. Could not find tuple in destination."); - - check_relation(trace); - EXPECT_THROW_WITH_MESSAGE(check_interaction(trace), - "Relation.*SCALAR_MUL_DOUBLE.* ACCUMULATION.* is non-zero"); - EXPECT_THROW_WITH_MESSAGE(check_interaction(trace), - "Relation.*SCALAR_MUL_ADD.* ACCUMULATION.* is non-zero"); } TEST(ScalarMulConstrainingTest, NegativeMulRadixInteractions) @@ -657,8 +643,6 @@ TEST(ScalarMulConstrainingTest, NegativeMulRadixInteractions) "Failed.*SCALAR_MUL_TO_RADIX. Could not find tuple in destination."); check_relation(trace); - EXPECT_THROW_WITH_MESSAGE(check_interaction(trace), - "Relation.*SCALAR_MUL_TO_RADIX.* ACCUMULATION.* is non-zero"); } TEST(ScalarMulConstrainingTest, NegativeDisableSel) diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/field_gt.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/field_gt.test.cpp index 04c2bff59c6b..28c735c57a9f 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/field_gt.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/field_gt.test.cpp @@ -121,8 +121,6 @@ TEST_P(InteractionsTests, InteractionsWithRangeCheck) LookupIntoDynamicTableSequential().process(trace); check_relation(trace); - check_interaction(trace); - check_interaction(trace); } INSTANTIATE_TEST_SUITE_P(FieldGreaterThanConstrainingTest, InteractionsTests, ::testing::ValuesIn(comparison_tests)); diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/instr_fetching.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/instr_fetching.test.cpp index 510a07df3c63..716e59a61c3d 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/instr_fetching.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/instr_fetching.test.cpp @@ -231,7 +231,6 @@ TEST(InstrFetchingConstrainingTest, WireInstructionSpecInteractions) EXPECT_EQ(trace.get_num_rows(), 1 << 8); // 2^8 for selector against wire_instruction_spec check_relation(trace); - check_interaction(trace); } std::vector gen_range_check_events(const std::vector& instr_events) @@ -250,34 +249,6 @@ std::vector gen_range_check_events(const std::vector().process(trace); - LookupIntoDynamicTableGeneric().process(trace); - - EXPECT_EQ(trace.get_num_rows(), 1 << 16); // 2^16 for range checks - - check_relation(trace); - check_interaction(trace); - check_interaction(trace); -} - // Positive test for the interaction with bytecode decomposition table. // One event/row is generated per wire opcode (same as for test WireInstructionSpecInteractions). TEST(InstrFetchingConstrainingTest, BcDecompositionInteractions) @@ -302,8 +273,6 @@ TEST(InstrFetchingConstrainingTest, BcDecompositionInteractions) EXPECT_EQ(trace.get_num_rows(), instr_fetch_events.at(0).bytecode->size() + 1); check_relation(trace); - check_interaction(trace); - check_interaction(trace); } void check_all(const std::vector& instr_events, @@ -334,12 +303,31 @@ void check_all(const std::vector& instr_events, EXPECT_EQ(trace.get_num_rows(), 1 << 16); // 2^16 for range checks check_relation(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); +} + +void check_without_range_check(const std::vector& instr_events, + const std::vector& decomposition_events) +{ + TestTraceContainer trace; + BytecodeTraceBuilder bytecode_builder; + PrecomputedTraceBuilder precomputed_builder; + + precomputed_builder.process_wire_instruction_spec(trace); + precomputed_builder.process_sel_range_8(trace); + precomputed_builder.process_memory_tag_range(trace); + bytecode_builder.process_instruction_fetching(instr_events, trace); + bytecode_builder.process_decomposition(decomposition_events, trace); + precomputed_builder.process_misc(trace, trace.get_num_rows()); // Limit to the number of rows we need. + + LookupIntoIndexedByClk().process(trace); + LookupIntoIndexedByClk().process(trace); + LookupIntoIndexedByClk().process(trace); + LookupIntoDynamicTableGeneric().process(trace); + LookupIntoDynamicTableGeneric().process(trace); + + EXPECT_EQ(trace.get_num_rows(), 1 << 8); // 2^8 for range checks + + check_relation(trace); } // Positive test with 5 five bytecodes and bytecode_id = 0,1,2,3,4 @@ -413,7 +401,7 @@ TEST(InstrFetchingConstrainingTest, SingleInstructionOutOfRange) }, }; - check_all(instr_events, gen_range_check_events(instr_events), decomposition_events); + check_without_range_check(instr_events, decomposition_events); } // Positive test with one single instruction (SET_FF) with error INSTRUCTION_OUT_OF_RANGE. @@ -450,7 +438,7 @@ TEST(InstrFetchingConstrainingTest, SingleInstructionOutOfRangeSplitOperand) }, }; - check_all(instr_events, gen_range_check_events(instr_events), decomposition_events); + check_without_range_check(instr_events, decomposition_events); } // Positive test with error case PC_OUT_OF_RANGE. We pass a pc which is out of range. @@ -529,7 +517,7 @@ TEST(InstrFetchingConstrainingTest, SingleInstructionOpcodeOutOfRange) }, }; - check_all(instr_events, gen_range_check_events(instr_events), decomposition_events); + check_without_range_check(instr_events, decomposition_events); } // Positive test with one single instruction (SET_16) with error TAG_OUT_OF_RANGE. @@ -563,11 +551,12 @@ TEST(InstrFetchingConstrainingTest, SingleInstructionTagOutOfRange) }, }; - check_all(instr_events, gen_range_check_events(instr_events), decomposition_events); + check_without_range_check(instr_events, decomposition_events); } +// TODO(jeanmon): Reconsider this test after #13140 // Negative interaction test with some values not matching the instruction spec table. -TEST(InstrFetchingConstrainingTest, NegativeWrongWireInstructionSpecInteractions) +TEST(InstrFetchingConstrainingTest, DISABLED_NegativeWrongWireInstructionSpecInteractions) { BytecodeTraceBuilder bytecode_builder; PrecomputedTraceBuilder precomputed_builder; @@ -592,7 +581,6 @@ TEST(InstrFetchingConstrainingTest, NegativeWrongWireInstructionSpecInteractions LookupIntoIndexedByClk().process(trace); ASSERT_EQ(trace.get(C::lookup_instr_fetching_wire_instruction_info_counts, static_cast(opcode)), 1); - check_interaction(trace); constexpr std::array mutated_cols = { C::instr_fetching_exec_opcode, C::instr_fetching_instr_size, C::instr_fetching_sel_has_tag, @@ -614,9 +602,8 @@ TEST(InstrFetchingConstrainingTest, NegativeWrongWireInstructionSpecInteractions // We do not need to re-run LookupIntoIndexedByClk().process(trace); // because we never mutate the indexing column for this lookup (clk) and for this lookup // find_in_dst only uses column C::instr_fetching_bd0 mapped to (clk). So, the counts are still valid. - - EXPECT_THROW_WITH_MESSAGE(check_interaction(mutated_trace), - "Relation.*WIRE_INSTRUCTION_INFO.* ACCUMULATION.* is non-zero"); + // EXPECT_THROW_WITH_MESSAGE(check_interaction(mutated_trace), + // "Relation.*WIRE_INSTRUCTION_INFO.* ACCUMULATION.* is non-zero"); } } } @@ -650,7 +637,6 @@ TEST(InstrFetchingConstrainingTest, NegativeWrongBcDecompositionInteractions) auto valid_trace = trace; // Keep original trace before lookup processing LookupIntoDynamicTableSequential().process(valid_trace); - check_interaction(valid_trace); constexpr std::array mutated_cols = { C::instr_fetching_pc, C::instr_fetching_bytecode_id, C::instr_fetching_bd0, C::instr_fetching_bd1, @@ -671,14 +657,11 @@ TEST(InstrFetchingConstrainingTest, NegativeWrongBcDecompositionInteractions) const FF mutated_value = trace.get(col, 1) + 1; // Mutate to value + 1 mutated_trace.set(col, 1, mutated_value); - // This sets the length of the inverse polynomial via SetDummyInverses, so we still need to call this - // even though we know it will fail. + // This sets the length of the inverse polynomial via SetDummyInverses, so we + // still need to call this even though we know it will fail. EXPECT_THROW_WITH_MESSAGE( LookupIntoDynamicTableSequential().process(mutated_trace), "Failed.*BYTES_FROM_BC_DEC. Could not find tuple in destination."); - - EXPECT_THROW_WITH_MESSAGE(check_interaction(mutated_trace), - "Relation.*BYTES_FROM_BC_DEC.* ACCUMULATION.* is non-zero"); } } } @@ -724,7 +707,6 @@ TEST(InstrFetchingConstrainingTest, NegativeWrongBytecodeSizeBcDecompositionInte auto valid_trace = trace; // Keep original trace before lookup processing LookupIntoDynamicTableSequential().process(valid_trace); - check_interaction(valid_trace); auto mutated_trace = trace; const FF mutated_value = trace.get(C::instr_fetching_bytecode_size, 1) + 1; // Mutate to value + 1 @@ -735,14 +717,12 @@ TEST(InstrFetchingConstrainingTest, NegativeWrongBytecodeSizeBcDecompositionInte EXPECT_THROW_WITH_MESSAGE( LookupIntoDynamicTableSequential().process(mutated_trace), "Failed.*BYTECODE_SIZE_FROM_BC_DEC. Could not find tuple in destination."); - - EXPECT_THROW_WITH_MESSAGE(check_interaction(mutated_trace), - "Relation.*BYTECODE_SIZE_FROM_BC_DEC.* ACCUMULATION.* is non-zero"); } } +// TODO(jeanmon): Reconsider this test after #13140 // Negative interaction test for #[TAG_VALUE_VALIDATION] where tag_out_of_range is wrongly mutated -TEST(InstrFetchingConstrainingTest, NegativeWrongTagValidationInteractions) +TEST(InstrFetchingConstrainingTest, DISABLED_NegativeWrongTagValidationInteractions) { TestTraceContainer trace; BytecodeTraceBuilder bytecode_builder; @@ -768,7 +748,6 @@ TEST(InstrFetchingConstrainingTest, NegativeWrongTagValidationInteractions) LookupIntoIndexedByClk().process(trace); auto valid_trace = trace; // Keep original trace before lookup processing - check_interaction(valid_trace); // Mutate tag out-of-range error auto mutated_trace = trace; @@ -778,9 +757,8 @@ TEST(InstrFetchingConstrainingTest, NegativeWrongTagValidationInteractions) // We do not need to re-run LookupIntoIndexedByClk().process(trace); // because we never mutate the indexing column for this lookup (clk) and for this lookup // find_in_dst only uses column C::instr_fetching_tag_value mapped to (clk). So, the counts are still valid. - - EXPECT_THROW_WITH_MESSAGE(check_interaction(mutated_trace), - "Relation.*TAG_VALUE_VALIDATION.* ACCUMULATION.* is non-zero"); + // EXPECT_THROW_WITH_MESSAGE(check_interaction(mutated_trace), + // "Relation.*TAG_VALUE_VALIDATION.* ACCUMULATION.* is non-zero"); } } diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/merkle_check.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/merkle_check.test.cpp index 0c3926a28d49..a6cc851b2433 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/merkle_check.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/merkle_check.test.cpp @@ -581,8 +581,6 @@ TEST(MerkleCheckConstrainingTest, ReadWithInteractions) LookupIntoDynamicTableSequential().process(trace); LookupIntoDynamicTableSequential().process(trace); - check_interaction(trace); - check_interaction(trace); check_relation(trace); // Negative test - now corrupt the trace and verify it fails @@ -590,10 +588,7 @@ TEST(MerkleCheckConstrainingTest, ReadWithInteractions) EXPECT_THROW_WITH_MESSAGE(LookupIntoDynamicTableSequential().process(trace), "Failed.*LOOKUP_MERKLE_CHECK_MERKLE_POSEIDON2.* Could not find tuple in destination"); - EXPECT_THROW_WITH_MESSAGE(check_interaction(trace), - "Relation.*LOOKUP_MERKLE_CHECK_MERKLE_POSEIDON2.* ACCUMULATION.* is non-zero"); LookupIntoDynamicTableSequential().process(trace); - check_interaction(trace); } TEST(MerkleCheckConstrainingTest, WriteWithInteractions) @@ -626,8 +621,6 @@ TEST(MerkleCheckConstrainingTest, WriteWithInteractions) LookupIntoDynamicTableSequential().process(trace); LookupIntoDynamicTableSequential().process(trace); - check_interaction(trace); - check_interaction(trace); check_relation(trace); // Negative test - now corrupt the trace and verify it fails @@ -637,14 +630,10 @@ TEST(MerkleCheckConstrainingTest, WriteWithInteractions) EXPECT_THROW_WITH_MESSAGE( LookupIntoDynamicTableSequential().process(trace), "Failed.*LOOKUP_MERKLE_CHECK_MERKLE_POSEIDON2_READ.* Could not find tuple in destination"); - EXPECT_THROW_WITH_MESSAGE(check_interaction(trace), - "Relation.*LOOKUP_MERKLE_CHECK_MERKLE_POSEIDON2_READ.* ACCUMULATION.* is non-zero"); - EXPECT_THROW_WITH_MESSAGE( - LookupIntoDynamicTableSequential().process(trace), - "Failed.*LOOKUP_MERKLE_CHECK_MERKLE_POSEIDON2_WRITE.* Could not find tuple in destination"); - EXPECT_THROW_WITH_MESSAGE(check_interaction(trace), - "Relation.*LOOKUP_MERKLE_CHECK_MERKLE_POSEIDON2_WRITE.* ACCUMULATION.* is non-zero"); + EXPECT_THROW_WITH_MESSAGE(LookupIntoDynamicTableSequential().process(trace), + "Failed.*LOOKUP_MERKLE_CHECK_MERKLE_POSEIDON2_WRITE.* Could not find tuple in " + "destination"); } TEST(MerkleCheckConstrainingTest, MultipleWithTracegen) @@ -738,8 +727,6 @@ TEST(MerkleCheckConstrainingTest, MultipleWithInteractions) LookupIntoDynamicTableSequential().process(trace); LookupIntoDynamicTableSequential().process(trace); - check_interaction(trace); - check_interaction(trace); check_relation(trace); } diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/poseidon2.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/poseidon2.test.cpp index 1d6b2d455147..8b872130f788 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/poseidon2.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/poseidon2.test.cpp @@ -185,7 +185,6 @@ TEST(Poseidon2ConstrainingTest, HashPermInteractions) check_relation(trace); check_relation(trace); - check_interaction(trace); } TEST(Poseidon2ConstrainingTest, NegativeHashPermInteractions) @@ -215,8 +214,6 @@ TEST(Poseidon2ConstrainingTest, NegativeHashPermInteractions) EXPECT_EQ(trace.get_num_rows(), /*start_row=*/1 + /*first_invocation=*/2); check_relation(trace); - EXPECT_THROW_WITH_MESSAGE(check_interaction(trace), - "Relation.*POSEIDON2_PERM.* ACCUMULATION.* is non-zero"); } } // namespace bb::avm2::constraining diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/sha256.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/sha256.test.cpp index 3670716b207d..fb3af74d690a 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/sha256.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/sha256.test.cpp @@ -123,7 +123,6 @@ TEST(Sha256ConstrainingTest, Interaction) LookupIntoIndexedByClk().process(trace); check_relation(trace); - check_interaction(trace); } } // namespace diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/to_radix.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/to_radix.test.cpp index 793c1bcbfeb1..beb76e68f902 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/to_radix.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/to_radix.test.cpp @@ -240,11 +240,6 @@ TEST(ToRadixConstrainingTest, ToLeBitsInteractions) LookupIntoIndexedByClk().process(trace); check_relation(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); } TEST(ToRadixConstrainingTest, ToLeRadixInteractions) @@ -275,11 +270,6 @@ TEST(ToRadixConstrainingTest, ToLeRadixInteractions) LookupIntoIndexedByClk().process(trace); check_relation(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); - check_interaction(trace); } TEST(ToRadixConstrainingTest, NegativeOverflowCheck)