|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include "barretenberg/stdlib/primitives/group/cycle_group.hpp"#include "barretenberg/circuit_checker/circuit_checker.hpp"#include "barretenberg/common/assert.hpp"#include "barretenberg/common/ref_span.hpp"#include "barretenberg/crypto/pedersen_commitment/pedersen.hpp"#include "barretenberg/crypto/pedersen_hash/pedersen.hpp"#include "barretenberg/numeric/random/engine.hpp"#include "barretenberg/stdlib/primitives/bigfield/bigfield.hpp"#include "barretenberg/stdlib/primitives/field/field.hpp"#include "barretenberg/stdlib/primitives/test_utils.hpp"#include "barretenberg/stdlib/primitives/witness/witness.hpp"#include "barretenberg/stdlib_circuit_builders/mega_circuit_builder.hpp"#include "barretenberg/stdlib_circuit_builders/plookup_tables/fixed_base/fixed_base.hpp"#include "barretenberg/transcript/origin_tag.hpp"#include <gtest/gtest.h>Go to the source code of this file.
Classes | |
| class | CycleGroupTest< Builder > |
Macros | |
| #define | STDLIB_TYPE_ALIASES |
Typedefs | |
| using | CircuitTypes = ::testing::Types< bb::UltraCircuitBuilder, bb::MegaCircuitBuilder > |
Functions | |
| TYPED_TEST_SUITE (CycleGroupTest, CircuitTypes) | |
| STANDARD_TESTING_TAGS | TYPED_TEST (CycleGroupTest, TestBasicTagLogic) |
| Check basic tag interactions. | |
| TYPED_TEST (CycleGroupTest, TestInfConstantWintnessRegression) | |
| Checks that a point at infinity passes the constant_witness initialization. | |
| TYPED_TEST (CycleGroupTest, TestWitnessSumRegression) | |
| Checks that the result of adding two witness values is not constant. | |
| TYPED_TEST (CycleGroupTest, TestOperatorNegRegression) | |
| Checks that adding operator-(value) to an existing value does not result into error. | |
| TYPED_TEST (CycleGroupTest, TestConstantWitnessMixupRegression) | |
| Checks the mixup bad behavior found by fuzzer. | |
| TYPED_TEST (CycleGroupTest, TestConditionalAssignRegression) | |
| Checks the bad behavior of conditional assign. | |
| TYPED_TEST (CycleGroupTest, TestConditionalAssignSuperMixupRegression) | |
| Checks the bad behavior of conditional assign. | |
| TYPED_TEST (CycleGroupTest, TestValidateOnCurveSucceed) | |
| Checks that a point on the curve passes the validate_on_curve check. | |
| TYPED_TEST (CycleGroupTest, TestValidateOnCurveInfinitySucceed) | |
| Checks that the point at infinity passes the validate_on_curve check. | |
| TYPED_TEST (CycleGroupTest, TestValidateOnCurveFail) | |
| Checks that a point that is not on the curve but not marked as the point at infinity fails the validate_on_curve check. | |
| TYPED_TEST (CycleGroupTest, TestValidateOnCurveFail2) | |
| Checks that a point that is not on the curve but not marked as the point at infinity fails the validate_on_curve check. | |
| TYPED_TEST (CycleGroupTest, TestStandardForm) | |
| TYPED_TEST (CycleGroupTest, TestDbl) | |
| TYPED_TEST (CycleGroupTest, TestDblNonConstantPoints) | |
| TYPED_TEST (CycleGroupTest, TestDblConstantPoints) | |
| TYPED_TEST (CycleGroupTest, TestDblMixedConstantWitness) | |
| TYPED_TEST (CycleGroupTest, TestUnconditionalAddNonConstantPoints) | |
| TYPED_TEST (CycleGroupTest, TestUnconditionalAddConstantPoints) | |
| TYPED_TEST (CycleGroupTest, TestUnconditionalSubtractNonConstantPoints) | |
| TYPED_TEST (CycleGroupTest, TestUnconditionalSubtractConstantPoints) | |
| TYPED_TEST (CycleGroupTest, TestUnconditionalAdd) | |
| TYPED_TEST (CycleGroupTest, TestConstrainedUnconditionalAddSucceed) | |
| TYPED_TEST (CycleGroupTest, TestConstrainedUnconditionalAddFail) | |
| TYPED_TEST (CycleGroupTest, TestAddRegular) | |
| TYPED_TEST (CycleGroupTest, TestAddLhsInfinity) | |
| TYPED_TEST (CycleGroupTest, TestAddRhsInfinity) | |
| TYPED_TEST (CycleGroupTest, TestAddBothInfinity) | |
| TYPED_TEST (CycleGroupTest, TestAddInversePoints) | |
| TYPED_TEST (CycleGroupTest, TestAddDoubling) | |
| TYPED_TEST (CycleGroupTest, TestAddConstantPoints) | |
| TYPED_TEST (CycleGroupTest, TestAddMixedConstantWitness) | |
| TYPED_TEST (CycleGroupTest, TestAddInfinityResultLogic) | |
| TYPED_TEST (CycleGroupTest, TestUnconditionalSubtract) | |
| TYPED_TEST (CycleGroupTest, TestConstrainedUnconditionalSubtractSucceed) | |
| TYPED_TEST (CycleGroupTest, TestConstrainedUnconditionalSubtractFail) | |
| TYPED_TEST (CycleGroupTest, TestSubtract) | |
| TYPED_TEST (CycleGroupTest, TestSubtractConstantPoints) | |
| template<typename T1 , typename T2 > | |
| auto | assign_and_merge_tags (T1 &points, T2 &scalars) |
| Assign different tags to all points and scalars and return the union of that tag. | |
| TYPED_TEST (CycleGroupTest, TestBatchMulGeneralMSM) | |
| TYPED_TEST (CycleGroupTest, TestBatchMulProducesInfinity) | |
| TYPED_TEST (CycleGroupTest, TestBatchMulMultiplyByZero) | |
| TYPED_TEST (CycleGroupTest, TestBatchMulInputsAreInfinity) | |
| TYPED_TEST (CycleGroupTest, TestBatchMulFixedBaseInLookupTable) | |
| TYPED_TEST (CycleGroupTest, TestBatchMulFixedBaseSomeInLookupTable) | |
| TYPED_TEST (CycleGroupTest, TestBatchMulFixedBaseZeroScalars) | |
| TYPED_TEST (CycleGroupTest, TestMul) | |
| TYPED_TEST (CycleGroupTest, TestOne) | |
| TYPED_TEST (CycleGroupTest, TestConversionFromBigfield) | |
| Ensures naive conversion from a bigfield representation of bb::fq (Grumpkin::ScalarField) to cycle_scalar preserves the same value until we implement a smarter function. | |
| TYPED_TEST (CycleGroupTest, TestBatchMulIsConsistent) | |
| TYPED_TEST (CycleGroupTest, TestFixedBaseBatchMul) | |
| Test fixed-base batch multiplication via the public batch_mul interface. | |
| TYPED_TEST (CycleGroupTest, TestInfinityChainedOperations) | |
| Test chained operations involving infinity. | |
| TYPED_TEST (CycleGroupTest, TestConditionalAssignWithInfinity) | |
| Test conditional_assign with infinity points. | |
| TYPED_TEST (CycleGroupTest, TestWitnessInfinityFromOperations) | |
| Test that witness infinity (created via operations like P - P) works correctly. | |
| TYPED_TEST (CycleGroupTest, TestBatchMulCompleteCancellation) | |
| Test batch_mul where all terms cancel to produce infinity. | |
| TYPED_TEST (CycleGroupTest, TestInfinityCanonicalRepresentation) | |
| Test that infinity is correctly identified after operations. | |
| TYPED_TEST (CycleGroupTest, TestInfinityAutoDetectionInConstructor) | |
| Test auto-detection of infinity in the 3-argument constructor. | |
| #define STDLIB_TYPE_ALIASES |
Definition at line 17 of file cycle_group.test.cpp.
| using CircuitTypes = ::testing::Types<bb::UltraCircuitBuilder, bb::MegaCircuitBuilder> |
Definition at line 56 of file cycle_group.test.cpp.
| auto assign_and_merge_tags | ( | T1 & | points, |
| T2 & | scalars | ||
| ) |
Assign different tags to all points and scalars and return the union of that tag.
We assign the tags with the same round index to a (point,scalar) pair, but the point is treated as submitted value, while scalar as a challenge. Merging these tags should not run into any edgecases
Definition at line 1369 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestAddBothInfinity | |||
| ) |
Definition at line 901 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestAddConstantPoints | |||
| ) |
Definition at line 974 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestAddDoubling | |||
| ) |
Definition at line 952 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestAddInfinityResultLogic | |||
| ) |
Definition at line 1061 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestAddInversePoints | |||
| ) |
Definition at line 929 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestAddLhsInfinity | |||
| ) |
Definition at line 848 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestAddMixedConstantWitness | |||
| ) |
Definition at line 1016 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestAddRegular | |||
| ) |
Definition at line 823 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestAddRhsInfinity | |||
| ) |
Definition at line 874 of file cycle_group.test.cpp.
| STANDARD_TESTING_TAGS TYPED_TEST | ( | CycleGroupTest | , |
| TestBasicTagLogic | |||
| ) |
Check basic tag interactions.
Definition at line 67 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestBatchMulCompleteCancellation | |||
| ) |
Test batch_mul where all terms cancel to produce infinity.
Definition at line 1974 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestBatchMulFixedBaseInLookupTable | |||
| ) |
Definition at line 1529 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestBatchMulFixedBaseSomeInLookupTable | |||
| ) |
Definition at line 1567 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestBatchMulFixedBaseZeroScalars | |||
| ) |
Definition at line 1617 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestBatchMulGeneralMSM | |||
| ) |
Definition at line 1383 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestBatchMulInputsAreInfinity | |||
| ) |
Definition at line 1491 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestBatchMulIsConsistent | |||
| ) |
Definition at line 1745 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestBatchMulMultiplyByZero | |||
| ) |
Definition at line 1465 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestBatchMulProducesInfinity | |||
| ) |
Definition at line 1434 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestConditionalAssignRegression | |||
| ) |
Checks the bad behavior of conditional assign.
Definition at line 188 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestConditionalAssignSuperMixupRegression | |||
| ) |
Checks the bad behavior of conditional assign.
Definition at line 204 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestConditionalAssignWithInfinity | |||
| ) |
Test conditional_assign with infinity points.
Tests that cycle_group::conditional_assign correctly handles infinity points
Definition at line 1890 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestConstantWitnessMixupRegression | |||
| ) |
Checks the mixup bad behavior found by fuzzer.
Definition at line 165 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestConstrainedUnconditionalAddFail | |||
| ) |
Definition at line 803 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestConstrainedUnconditionalAddSucceed | |||
| ) |
Definition at line 784 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestConstrainedUnconditionalSubtractFail | |||
| ) |
Definition at line 1188 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestConstrainedUnconditionalSubtractSucceed | |||
| ) |
Definition at line 1169 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestConversionFromBigfield | |||
| ) |
Ensures naive conversion from a bigfield representation of bb::fq (Grumpkin::ScalarField) to cycle_scalar preserves the same value until we implement a smarter function.
Definition at line 1716 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestDbl | |||
| ) |
Definition at line 363 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestDblConstantPoints | |||
| ) |
Definition at line 450 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestDblMixedConstantWitness | |||
| ) |
Definition at line 523 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestDblNonConstantPoints | |||
| ) |
Definition at line 392 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestFixedBaseBatchMul | |||
| ) |
Test fixed-base batch multiplication via the public batch_mul interface.
Tests that the fixed-base MSM works correctly for the two supported Pedersen generators
Definition at line 1796 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestInfConstantWintnessRegression | |||
| ) |
Checks that a point at infinity passes the constant_witness initialization.
Definition at line 110 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestInfinityAutoDetectionInConstructor | |||
| ) |
Test auto-detection of infinity in the 3-argument constructor.
When coordinates are (0, 0), the point should be auto-detected as infinity
Definition at line 2062 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestInfinityCanonicalRepresentation | |||
| ) |
Test that infinity is correctly identified after operations.
Definition at line 2012 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestInfinityChainedOperations | |||
| ) |
Test chained operations involving infinity.
Tests that operations like (a + infinity) - a = infinity work correctly
Definition at line 1832 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestMul | |||
| ) |
Definition at line 1647 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestOne | |||
| ) |
Definition at line 1700 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestOperatorNegRegression | |||
| ) |
Checks that adding operator-(value) to an existing value does not result into error.
Definition at line 145 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestStandardForm | |||
| ) |
Definition at line 298 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestSubtract | |||
| ) |
Definition at line 1206 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestSubtractConstantPoints | |||
| ) |
Definition at line 1304 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestUnconditionalAdd | |||
| ) |
Definition at line 756 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestUnconditionalAddConstantPoints | |||
| ) |
Definition at line 606 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestUnconditionalAddNonConstantPoints | |||
| ) |
Definition at line 545 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestUnconditionalSubtract | |||
| ) |
Definition at line 1140 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestUnconditionalSubtractConstantPoints | |||
| ) |
Definition at line 712 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestUnconditionalSubtractNonConstantPoints | |||
| ) |
Definition at line 650 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestValidateOnCurveFail | |||
| ) |
Checks that a point that is not on the curve but not marked as the point at infinity fails the validate_on_curve check.
(1, 1) is not on the either the Grumpkin curve or the BN254 curve.
Definition at line 260 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestValidateOnCurveFail2 | |||
| ) |
Checks that a point that is not on the curve but not marked as the point at infinity fails the validate_on_curve check.
(1, 1) is not on the either the Grumpkin curve or the BN254 curve.
Definition at line 281 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestValidateOnCurveInfinitySucceed | |||
| ) |
Checks that the point at infinity passes the validate_on_curve check.
Definition at line 244 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestValidateOnCurveSucceed | |||
| ) |
Checks that a point on the curve passes the validate_on_curve check.
Definition at line 224 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestWitnessInfinityFromOperations | |||
| ) |
Test that witness infinity (created via operations like P - P) works correctly.
This is different from constant_infinity() - it's an infinity point that resulted from circuit operations where the prover computes it.
Definition at line 1941 of file cycle_group.test.cpp.
| TYPED_TEST | ( | CycleGroupTest | , |
| TestWitnessSumRegression | |||
| ) |
Checks that the result of adding two witness values is not constant.
Definition at line 126 of file cycle_group.test.cpp.
| TYPED_TEST_SUITE | ( | CycleGroupTest | , |
| CircuitTypes | |||
| ) |