Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
generic_permutation_relation.test.cpp File Reference
#include "generic_permutation_relation.hpp"
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include "barretenberg/relations/relation_parameters.hpp"
#include <array>
#include <gtest/gtest.h>

Go to the source code of this file.

Classes

struct  SettingsBasicPermutation
 
class  GenericPermutationRelationTest< Settings >
 
class  BasicPermutationTest
 

Typedefs

using FF = bb::fr
 

Functions

 TEST_F (BasicPermutationTest, InactiveRow)
 An all-zero row must leave both subrelations at zero.
 
 TEST_F (BasicPermutationTest, ValidLookupRow)
 A correctly-set-up lookup row satisfies subrelation 0.
 
 TEST_F (BasicPermutationTest, ValidTableRow)
 A correctly-set-up table row satisfies subrelation 0.
 
 TEST_F (BasicPermutationTest, ValidTrace)
 A two-row trace with matching lookup/table terms satisfies the log-derivative identity.
 
 TEST_F (BasicPermutationTest, IncorrectInverse)
 An active lookup row with an incorrect inverse violates subrelation 0.
 
 TEST_F (BasicPermutationTest, InvalidLookup)
 Table term mismatch: lookup_term0 = 1*beta+2+gamma, table_term1 = 2*beta+4+gamma → acc[1] ≠ 0.
 

Typedef Documentation

◆ FF

using FF = bb::fr

Definition at line 8 of file generic_permutation_relation.test.cpp.

Function Documentation

◆ TEST_F() [1/6]

TEST_F ( BasicPermutationTest  ,
InactiveRow   
)

An all-zero row must leave both subrelations at zero.

When no predicate is active, inverse_exists = 0, lookup_inverse = 0: subrel_0 = (prod * 0 - 0) * sf = 0 subrel_1 += 0 * ... - 0 * ... = 0

Definition at line 171 of file generic_permutation_relation.test.cpp.

◆ TEST_F() [2/6]

TEST_F ( BasicPermutationTest  ,
IncorrectInverse   
)

An active lookup row with an incorrect inverse violates subrelation 0.

We set I to a wrong value (not the product-inverse) and confirm subrelation 0 ≠ 0.

Definition at line 265 of file generic_permutation_relation.test.cpp.

◆ TEST_F() [3/6]

TEST_F ( BasicPermutationTest  ,
InvalidLookup   
)

Table term mismatch: lookup_term0 = 1*beta+2+gamma, table_term1 = 2*beta+4+gamma → acc[1] ≠ 0.

Definition at line 299 of file generic_permutation_relation.test.cpp.

◆ TEST_F() [4/6]

TEST_F ( BasicPermutationTest  ,
ValidLookupRow   
)

A correctly-set-up lookup row satisfies subrelation 0.

With lookup_predicate=1, table_predicate=0: inverse_exists = 1 I = 1 / (lookup_term * table_term) subrel_0 = I * lookup_term * table_term - 1 = 0

Definition at line 188 of file generic_permutation_relation.test.cpp.

◆ TEST_F() [5/6]

TEST_F ( BasicPermutationTest  ,
ValidTableRow   
)

A correctly-set-up table row satisfies subrelation 0.

With lookup_predicate=0, table_predicate=1, read_count=1: inverse_exists = 1 I = 1 / (lookup_term * table_term) subrel_0 = I * lookup_term * table_term - 1 = 0

Definition at line 222 of file generic_permutation_relation.test.cpp.

◆ TEST_F() [6/6]

TEST_F ( BasicPermutationTest  ,
ValidTrace   
)

A two-row trace with matching lookup/table terms satisfies the log-derivative identity.

t1=1, t2=2 on row 1 → table_term1 = 1*beta + 2 + gamma = lookup_term0, so acc[1] = 0.

Definition at line 253 of file generic_permutation_relation.test.cpp.