Barretenberg
The ZK-SNARK library at the core of Aztec
|
Show that relation arithmetic has a simple form. More...
#include "barretenberg/relations/translator_vm/translator_extra_relations.hpp"
#include "barretenberg/translator_vm/translator_flavor.hpp"
#include <gtest/gtest.h>
Go to the source code of this file.
Classes | |
class | TranslatorRelationConsistency |
Typedefs | |
using | Flavor = TranslatorFlavor |
using | FF = typename Flavor::FF |
using | InputElements = typename Flavor::AllValues |
Functions | |
InputElements | get_random_input () |
InputElements | get_special_input () |
TEST_F (TranslatorRelationConsistency, PermutationRelation) | |
TEST_F (TranslatorRelationConsistency, DeltaRangeConstraintRelation) | |
TEST_F (TranslatorRelationConsistency, DecompositionRelation) | |
TEST_F (TranslatorRelationConsistency, OpcodeConstraintRelation) | |
TEST_F (TranslatorRelationConsistency, AccumulatorTransferRelation) | |
TEST_F (TranslatorRelationConsistency, ZeroConstraintsRelation) | |
TEST_F (TranslatorRelationConsistency, NonNativeFieldRelation) | |
Show that relation arithmetic has a simple form.
The purpose of this test suite is to show that the identity arithmetic implemented in the Relations is equivalent to a simpler unoptimized version implemented in the tests themselves. This is useful 1) as documentation since the simple implementations here should make the underlying arithmetic easier to see, and 2) as a check that optimizations introduced into the Relations have not changed the result.
For this purpose, we simply feed (the same) random inputs into each of the two implementations and confirm that the outputs match. This does not confirm the correctness of the identity arithmetic (the identities will not be satisfied in general by random inputs) only that the two implementations are equivalent.
Definition in file translator_relation_consistency.test.cpp.
using FF = typename Flavor::FF |
Definition at line 21 of file translator_relation_consistency.test.cpp.
using Flavor = TranslatorFlavor |
Definition at line 20 of file translator_relation_consistency.test.cpp.
using InputElements = typename Flavor::AllValues |
Definition at line 22 of file translator_relation_consistency.test.cpp.
InputElements get_random_input | ( | ) |
Definition at line 24 of file translator_relation_consistency.test.cpp.
InputElements get_special_input | ( | ) |
Definition at line 33 of file translator_relation_consistency.test.cpp.
TEST_F | ( | TranslatorRelationConsistency | , |
AccumulatorTransferRelation | |||
) |
Definition at line 754 of file translator_relation_consistency.test.cpp.
TEST_F | ( | TranslatorRelationConsistency | , |
DecompositionRelation | |||
) |
Check decomposition of a relation limb. Relation limbs are 84 bits, so the decompositon takes 6 14-bit microlimbs
Check the decomposition of a standard limb. Standard limbs are 68 bits, so we decompose them into 5 14-bit microlimbs
Check the decomposition of a standard top limb. Standard top limb is 50 bits (254 = 68 * 3 + 50)
Ensure that the last microlimb of a standard limb decomposition is 12 bits by checking a shifted version.
Ensure that the last microlimb of a standard top limb decomposition is 8 bits by checking a shifted version.
Ensure that the last microlimb of z top limb decomposition is 4 bits by checking a shifted version.
Ensure that the last microlimb of quotient top limb decomposition is 10 bits by checking a shifted version.
Check decomposition of wide 128-bit limbs into two 68-bit limbs.
Definition at line 179 of file translator_relation_consistency.test.cpp.
Definition at line 112 of file translator_relation_consistency.test.cpp.
TEST_F | ( | TranslatorRelationConsistency | , |
NonNativeFieldRelation | |||
) |
Definition at line 1042 of file translator_relation_consistency.test.cpp.
TEST_F | ( | TranslatorRelationConsistency | , |
OpcodeConstraintRelation | |||
) |
Definition at line 730 of file translator_relation_consistency.test.cpp.
TEST_F | ( | TranslatorRelationConsistency | , |
PermutationRelation | |||
) |
Definition at line 58 of file translator_relation_consistency.test.cpp.
TEST_F | ( | TranslatorRelationConsistency | , |
ZeroConstraintsRelation | |||
) |
Definition at line 817 of file translator_relation_consistency.test.cpp.