|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Tests for DatabusLookupRelation to verify the relation arithmetic matches a simple reference implementation. More...
#include "barretenberg/ecc/curves/bn254/fr.hpp"#include "barretenberg/relations/databus_lookup_relation.hpp"#include "barretenberg/relations/relation_parameters.hpp"#include <gtest/gtest.h>Go to the source code of this file.
Classes | |
| struct | DatabusInputElements |
| Input elements for DatabusLookupRelation testing. More... | |
| class | DatabusLookupRelationConsistency |
Typedefs | |
| using | FF = fr |
Functions | |
| TEST_F (DatabusLookupRelationConsistency, RandomInputs) | |
| Test all subrelations with random inputs. | |
| TEST_F (DatabusLookupRelationConsistency, InactiveGates) | |
| Test that inactive gates (all selectors and counts = 0) produce all-zero subrelations. | |
| TEST_F (DatabusLookupRelationConsistency, ValidInverseComputation) | |
| Test a valid read gate scenario where inverse is correctly computed. | |
| TEST_F (DatabusLookupRelationConsistency, MismatchedReadWriteTerms) | |
| Test that when lookup_term != table_term, the lookup identity fails. | |
| TEST_F (DatabusLookupRelationConsistency, InverseUnconstrainedAtInactiveRows) | |
| Test inverse correctness gating: I unconstrained at inactive rows. | |
| TEST_F (DatabusLookupRelationConsistency, WrongInverseOnReadRowFails) | |
| Test that a wrong inverse on a read row causes (1a) to fail. | |
| TEST_F (DatabusLookupRelationConsistency, WrongInverseOnWriteRowFails) | |
| Test that a wrong inverse on a write row causes (1b) to fail. | |
| TEST_F (DatabusLookupRelationConsistency, CorrectInverseOnWriteRow) | |
| Test that nonzero count with correct inverse satisfies all subrelations. | |
Tests for DatabusLookupRelation to verify the relation arithmetic matches a simple reference implementation.
Similar to ultra_relation_consistency.test.cpp, this test verifies that the optimized relation implementation produces the same results as a simpler, more readable reference implementation.
The DatabusLookupRelation implements a log-derivative lookup argument with 3 subrelations per bus column: 1a. Inverse correctness (read rows): (I * L * T - 1) * is_read = 0 1b. Inverse correctness (write rows): (I * L * T - 1) * count = 0
Definition in file databus_lookup_relation_consistency.test.cpp.
Definition at line 19 of file databus_lookup_relation_consistency.test.cpp.
| TEST_F | ( | DatabusLookupRelationConsistency | , |
| CorrectInverseOnWriteRow | |||
| ) |
Test that nonzero count with correct inverse satisfies all subrelations.
A pure write row (count != 0, no read gate) with I = 1/(L*T) should make (1b) zero and contribute correctly to the lookup identity.
Definition at line 544 of file databus_lookup_relation_consistency.test.cpp.
| TEST_F | ( | DatabusLookupRelationConsistency | , |
| InactiveGates | |||
| ) |
Test that inactive gates (all selectors and counts = 0) produce all-zero subrelations.
Definition at line 225 of file databus_lookup_relation_consistency.test.cpp.
| TEST_F | ( | DatabusLookupRelationConsistency | , |
| InverseUnconstrainedAtInactiveRows | |||
| ) |
Test inverse correctness gating: I unconstrained at inactive rows.
At rows where is_read = 0 and count = 0, the inverse can be anything without affecting any subrelation (since the lookup identity contribution is also zero).
Definition at line 391 of file databus_lookup_relation_consistency.test.cpp.
| TEST_F | ( | DatabusLookupRelationConsistency | , |
| MismatchedReadWriteTerms | |||
| ) |
Test that when lookup_term != table_term, the lookup identity fails.
Definition at line 331 of file databus_lookup_relation_consistency.test.cpp.
| TEST_F | ( | DatabusLookupRelationConsistency | , |
| RandomInputs | |||
| ) |
Test all subrelations with random inputs.
Verifies that the relation's accumulate function matches the simple reference implementation
Definition at line 206 of file databus_lookup_relation_consistency.test.cpp.
| TEST_F | ( | DatabusLookupRelationConsistency | , |
| ValidInverseComputation | |||
| ) |
Test a valid read gate scenario where inverse is correctly computed.
When I = 1/(L * T), both inverse correctness subrelations and the lookup identity should be satisfied
Definition at line 270 of file databus_lookup_relation_consistency.test.cpp.
| TEST_F | ( | DatabusLookupRelationConsistency | , |
| WrongInverseOnReadRowFails | |||
| ) |
Test that a wrong inverse on a read row causes (1a) to fail.
When is_read = 1 and I != 1/(L*T), subrelation (1a) should be nonzero.
Definition at line 441 of file databus_lookup_relation_consistency.test.cpp.
| TEST_F | ( | DatabusLookupRelationConsistency | , |
| WrongInverseOnWriteRowFails | |||
| ) |
Test that a wrong inverse on a write row causes (1b) to fail.
When count != 0 and I != 1/(L*T), subrelation (1b) should be nonzero.
Definition at line 491 of file databus_lookup_relation_consistency.test.cpp.