Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include "barretenberg/boomerang_value_detection/graph.hpp"
#include "barretenberg/numeric/random/engine.hpp"
#include "barretenberg/stdlib/primitives/bigfield/bigfield.hpp"
#include "barretenberg/ecc/curves/bn254/fq.hpp"
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include "barretenberg/circuit_checker/circuit_checker.hpp"
#include "barretenberg/common/test.hpp"
#include "barretenberg/stdlib/primitives/bool/bool.hpp"
#include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp"
#include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders.hpp"
#include "barretenberg/stdlib/primitives/curves/bn254.hpp"
#include "barretenberg/stdlib/primitives/field/field.hpp"
#include "barretenberg/transcript/origin_tag.hpp"
#include <memory>
#include <utility>
Go to the source code of this file.
Typedefs | |
using | Builder = UltraCircuitBuilder |
using | bn254 = stdlib::bn254< Builder > |
using | fr_ct = bn254::ScalarField |
using | fq_ct = bn254::BaseField |
using | public_witness_ct = bn254::public_witness_ct |
using | witness_ct = bn254::witness_ct |
Functions | |
void | fix_bigfield_element (const fq_ct &element) |
Fix a bigfield element to prevent it from being identified as a variable in one gate. | |
TEST (boomerang_bigfield, test_graph_description_bigfield_constructors) | |
Test graph description for bigfield constructors. | |
TEST (boomerang_bigfield, test_graph_description_bigfield_addition) | |
Test graph description for bigfield addition operations. | |
TEST (boomerang_bigfield, test_graph_description_bigfield_substraction) | |
Test graph description for bigfield subtraction operations. | |
TEST (boomerang_bigfield, test_graph_description_bigfield_multiplication) | |
Test graph description for bigfield multiplication operations. | |
TEST (boomerang_bigfield, test_graph_description_bigfield_division) | |
Test graph description for bigfield division operations. | |
TEST (boomerang_bigfield, test_graph_description_bigfield_mix_operations) | |
Test graph description for mixed bigfield operations. | |
TEST (boomerang_bigfield, test_graph_description_constructor_high_low_bits_and_operations) | |
Test graph description for high/low bits constructor and operations. | |
TEST (boomerang_bigfield, test_graph_description_mul_function) | |
Test graph description for multiple multiplication operations. | |
TEST (boomerang_bigfield, test_graph_description_sqr_function) | |
Test graph description for square operations. | |
TEST (boomerang_bigfield, test_graph_description_madd_function) | |
Test graph description for multiply-add operations. | |
TEST (boomerang_bigfield, test_graph_description_mult_madd_function) | |
Test graph description for multiple multiply-add operations. | |
TEST (boomerang_bigfield, test_graph_description_constructor_high_low_bits) | |
Test graph description for high/low bits constructor. | |
using bn254 = stdlib::bn254<Builder> |
Definition at line 27 of file graph_description_bigfield.test.cpp.
using Builder = UltraCircuitBuilder |
Definition at line 26 of file graph_description_bigfield.test.cpp.
using fq_ct = bn254::BaseField |
Definition at line 29 of file graph_description_bigfield.test.cpp.
using fr_ct = bn254::ScalarField |
Definition at line 28 of file graph_description_bigfield.test.cpp.
Definition at line 30 of file graph_description_bigfield.test.cpp.
using witness_ct = bn254::witness_ct |
Definition at line 31 of file graph_description_bigfield.test.cpp.
void fix_bigfield_element | ( | const fq_ct & | element | ) |
Fix a bigfield element to prevent it from being identified as a variable in one gate.
Static analyzer usually prints input and output variables as variables in one gate. In tests these variables are not dangerous and usually we can filter them by fixing the witness which adds a gate. Then these variables will be in 2 gates, and static analyzer won't print them.
element | The bigfield element to fix |
Definition at line 42 of file graph_description_bigfield.test.cpp.
TEST | ( | boomerang_bigfield | , |
test_graph_description_bigfield_addition | |||
) |
Test graph description for bigfield addition operations.
Tests various addition combinations with fix_bigfield_element.
The result is one connected component with no variables in one gate.
Definition at line 84 of file graph_description_bigfield.test.cpp.
TEST | ( | boomerang_bigfield | , |
test_graph_description_bigfield_constructors | |||
) |
Test graph description for bigfield constructors.
Tests construction of:
The result is one connected component with one variable in one gate.
Definition at line 61 of file graph_description_bigfield.test.cpp.
TEST | ( | boomerang_bigfield | , |
test_graph_description_bigfield_division | |||
) |
Test graph description for bigfield division operations.
Tests division operations with circuit checking. Each division operator creates one inverse variable for polynomial gate check (a * a_inv - 1 = 0).
The result is one connected component with three variables in one gate.
Definition at line 180 of file graph_description_bigfield.test.cpp.
TEST | ( | boomerang_bigfield | , |
test_graph_description_bigfield_mix_operations | |||
) |
Test graph description for mixed bigfield operations.
Tests combinations of addition, subtraction, multiplication and division operations.
The result is one connected component with two variables in one gate.
Definition at line 212 of file graph_description_bigfield.test.cpp.
TEST | ( | boomerang_bigfield | , |
test_graph_description_bigfield_multiplication | |||
) |
Test graph description for bigfield multiplication operations.
Tests all possible multiplication combinations.
The result is one connected component with no variables in one gate.
Definition at line 150 of file graph_description_bigfield.test.cpp.
TEST | ( | boomerang_bigfield | , |
test_graph_description_bigfield_substraction | |||
) |
Test graph description for bigfield subtraction operations.
Tests all possible subtraction combinations between mixed, constant, and variable values.
The result is one connected component with no variables in one gate.
Definition at line 115 of file graph_description_bigfield.test.cpp.
TEST | ( | boomerang_bigfield | , |
test_graph_description_constructor_high_low_bits | |||
) |
Test graph description for high/low bits constructor.
Tests basic multiplication with bit-sliced construction.
The result is connected components with no variables in one gate.
Definition at line 403 of file graph_description_bigfield.test.cpp.
TEST | ( | boomerang_bigfield | , |
test_graph_description_constructor_high_low_bits_and_operations | |||
) |
Test graph description for high/low bits constructor and operations.
Tests bit-sliced construction and repeated additions.
The result is one connected component with no variables in one gate.
Definition at line 265 of file graph_description_bigfield.test.cpp.
TEST | ( | boomerang_bigfield | , |
test_graph_description_madd_function | |||
) |
Test graph description for multiply-add operations.
Tests multiply-add operations with three inputs.
The result is num_repetitions connected components with no variables in one gate.
Definition at line 339 of file graph_description_bigfield.test.cpp.
TEST | ( | boomerang_bigfield | , |
test_graph_description_mul_function | |||
) |
Test graph description for multiple multiplication operations.
Tests independent multiplication operations.
The result is num_repetitions connected components with no variables in one gate.
Definition at line 293 of file graph_description_bigfield.test.cpp.
TEST | ( | boomerang_bigfield | , |
test_graph_description_mult_madd_function | |||
) |
Test graph description for multiple multiply-add operations.
Tests batch multiply-add operations with multiple inputs. Uses arrays of size number_of_madds=16 for left multiply, right multiply and add values.
The result is connected components with no variables in one gate.
Definition at line 366 of file graph_description_bigfield.test.cpp.
TEST | ( | boomerang_bigfield | , |
test_graph_description_sqr_function | |||
) |
Test graph description for square operations.
Tests repeated squaring operations on random inputs.
The result is num_repetitions connected components with no variables in one gate.
Definition at line 317 of file graph_description_bigfield.test.cpp.