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, 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.
 

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: 1a. Inverse correctness (read rows): (I * L * T - 1) * is_read = 0 1b. Inverse correctness (write rows): (I * L * T - 1) * count = 0

  1. Log-derivative lookup: sum of (is_read * T - count * L) * I = 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/8]

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() [2/8]

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() [3/8]

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() [4/8]

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() [5/8]

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() [6/8]

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() [7/8]

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() [8/8]

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.