Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
databus_lookup_relation_consistency.test.cpp File Reference

Tests for DatabusLookupRelation to verify the relation arithmetic matches a simple reference implementation. More...

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, BooleanReadTagsPass)
 Test with boolean read tags (valid values)
 
 TEST_F (DatabusLookupRelationConsistency, NonBooleanReadTagsFail)
 Test with non-boolean read tags (invalid values)
 
 TEST_F (DatabusLookupRelationConsistency, InactiveGates)
 Test that inactive gates (all selectors = 0) produce expected behavior.
 
 TEST_F (DatabusLookupRelationConsistency, ValidInverseComputation)
 Test a valid read gate scenario where inverse is correctly computed.
 
 TEST_F (DatabusLookupRelationConsistency, MismatchedReadWriteTerms)
 Test that when read_term != write_term, inverse correctness fails with wrong inverse.
 

Detailed Description

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:

  1. Inverse correctness: I * read_term * write_term - inverse_exists = 0
  2. Log-derivative lookup: sum of (read_selector * write_term - read_count * read_term) * I = 0
  3. Read tag boolean check: read_tag * read_tag - read_tag = 0

Definition in file databus_lookup_relation_consistency.test.cpp.

Typedef Documentation

◆ FF

using FF = fr

Definition at line 19 of file databus_lookup_relation_consistency.test.cpp.

Function Documentation

◆ TEST_F() [1/6]

TEST_F ( DatabusLookupRelationConsistency  ,
BooleanReadTagsPass   
)

Test with boolean read tags (valid values)

When read_tag is 0 or 1, the boolean check subrelation should be 0

Definition at line 205 of file databus_lookup_relation_consistency.test.cpp.

◆ TEST_F() [2/6]

TEST_F ( DatabusLookupRelationConsistency  ,
InactiveGates   
)

Test that inactive gates (all selectors = 0) produce expected behavior.

Definition at line 273 of file databus_lookup_relation_consistency.test.cpp.

◆ TEST_F() [3/6]

TEST_F ( DatabusLookupRelationConsistency  ,
MismatchedReadWriteTerms   
)

Test that when read_term != write_term, inverse correctness fails with wrong inverse.

If the value in bus doesn't match what's being read, the relation should fail

Definition at line 386 of file databus_lookup_relation_consistency.test.cpp.

◆ TEST_F() [4/6]

TEST_F ( DatabusLookupRelationConsistency  ,
NonBooleanReadTagsFail   
)

Test with non-boolean read tags (invalid values)

When read_tag is not 0 or 1, the boolean check subrelation should be non-zero

Definition at line 247 of file databus_lookup_relation_consistency.test.cpp.

◆ TEST_F() [5/6]

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 185 of file databus_lookup_relation_consistency.test.cpp.

◆ TEST_F() [6/6]

TEST_F ( DatabusLookupRelationConsistency  ,
ValidInverseComputation   
)

Test a valid read gate scenario where inverse is correctly computed.

When the inverse is set correctly: I = 1/(read_term * write_term), the inverse correctness subrelation should be zero (satisfied)

Definition at line 322 of file databus_lookup_relation_consistency.test.cpp.