Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
cycle_group.test.cpp File Reference

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, TestInfWintnessRegression)
 Checks that a point at infinity passes the 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 a point that is not on the curve but marked as 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, MixedLengthScalarsIsNotSupported)
 Temporary debugging test demonstrating that batch_mul with scalars of different bit lengths is not supported.
 
 TYPED_TEST (CycleGroupTest, TestFixedBaseBatchMul)
 Test fixed-base batch multiplication via the public batch_mul interface.
 

Macro Definition Documentation

◆ STDLIB_TYPE_ALIASES

#define STDLIB_TYPE_ALIASES
Value:
using Builder = TypeParam; \
using cycle_group_ct = stdlib::cycle_group<Builder>; \
using Element = typename Curve::Element; \
using AffineElement = typename Curve::AffineElement; \
using Group = typename Curve::Group; \
using cycle_scalar_ct = cycle_group_ct::cycle_scalar;
typename Group::element Element
Definition grumpkin.hpp:55
typename grumpkin::g1 Group
Definition grumpkin.hpp:54
typename Group::affine_element AffineElement
Definition grumpkin.hpp:56
Implements boolean logic in-circuit.
Definition bool.hpp:59
cycle_group represents a group Element of the proving system's embedded curve, i.e....
Curve::Element Element

Definition at line 16 of file cycle_group.test.cpp.

Typedef Documentation

◆ CircuitTypes

Definition at line 55 of file cycle_group.test.cpp.

Function Documentation

◆ assign_and_merge_tags()

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.

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 1388 of file cycle_group.test.cpp.

◆ TYPED_TEST() [1/51]

TYPED_TEST ( CycleGroupTest  ,
MixedLengthScalarsIsNotSupported   
)

Temporary debugging test demonstrating that batch_mul with scalars of different bit lengths is not supported.

Definition at line 1814 of file cycle_group.test.cpp.

◆ TYPED_TEST() [2/51]

TYPED_TEST ( CycleGroupTest  ,
TestAddBothInfinity   
)

Definition at line 921 of file cycle_group.test.cpp.

◆ TYPED_TEST() [3/51]

TYPED_TEST ( CycleGroupTest  ,
TestAddConstantPoints   
)

Definition at line 993 of file cycle_group.test.cpp.

◆ TYPED_TEST() [4/51]

TYPED_TEST ( CycleGroupTest  ,
TestAddDoubling   
)

Definition at line 971 of file cycle_group.test.cpp.

◆ TYPED_TEST() [5/51]

TYPED_TEST ( CycleGroupTest  ,
TestAddInfinityResultLogic   
)

Definition at line 1080 of file cycle_group.test.cpp.

◆ TYPED_TEST() [6/51]

TYPED_TEST ( CycleGroupTest  ,
TestAddInversePoints   
)

Definition at line 948 of file cycle_group.test.cpp.

◆ TYPED_TEST() [7/51]

TYPED_TEST ( CycleGroupTest  ,
TestAddLhsInfinity   
)

Definition at line 870 of file cycle_group.test.cpp.

◆ TYPED_TEST() [8/51]

TYPED_TEST ( CycleGroupTest  ,
TestAddMixedConstantWitness   
)

Definition at line 1035 of file cycle_group.test.cpp.

◆ TYPED_TEST() [9/51]

TYPED_TEST ( CycleGroupTest  ,
TestAddRegular   
)

Definition at line 845 of file cycle_group.test.cpp.

◆ TYPED_TEST() [10/51]

TYPED_TEST ( CycleGroupTest  ,
TestAddRhsInfinity   
)

Definition at line 895 of file cycle_group.test.cpp.

◆ TYPED_TEST() [11/51]

STANDARD_TESTING_TAGS TYPED_TEST ( CycleGroupTest  ,
TestBasicTagLogic   
)

Check basic tag interactions.

Definition at line 66 of file cycle_group.test.cpp.

◆ TYPED_TEST() [12/51]

TYPED_TEST ( CycleGroupTest  ,
TestBatchMulFixedBaseInLookupTable   
)

Definition at line 1551 of file cycle_group.test.cpp.

◆ TYPED_TEST() [13/51]

TYPED_TEST ( CycleGroupTest  ,
TestBatchMulFixedBaseSomeInLookupTable   
)

Definition at line 1589 of file cycle_group.test.cpp.

◆ TYPED_TEST() [14/51]

TYPED_TEST ( CycleGroupTest  ,
TestBatchMulFixedBaseZeroScalars   
)

Definition at line 1639 of file cycle_group.test.cpp.

◆ TYPED_TEST() [15/51]

TYPED_TEST ( CycleGroupTest  ,
TestBatchMulGeneralMSM   
)

Definition at line 1402 of file cycle_group.test.cpp.

◆ TYPED_TEST() [16/51]

TYPED_TEST ( CycleGroupTest  ,
TestBatchMulInputsAreInfinity   
)

Definition at line 1513 of file cycle_group.test.cpp.

◆ TYPED_TEST() [17/51]

TYPED_TEST ( CycleGroupTest  ,
TestBatchMulIsConsistent   
)

Definition at line 1764 of file cycle_group.test.cpp.

◆ TYPED_TEST() [18/51]

TYPED_TEST ( CycleGroupTest  ,
TestBatchMulMultiplyByZero   
)

Definition at line 1486 of file cycle_group.test.cpp.

◆ TYPED_TEST() [19/51]

TYPED_TEST ( CycleGroupTest  ,
TestBatchMulProducesInfinity   
)

Definition at line 1454 of file cycle_group.test.cpp.

◆ TYPED_TEST() [20/51]

TYPED_TEST ( CycleGroupTest  ,
TestConditionalAssignRegression   
)

Checks the bad behavior of conditional assign.

Definition at line 190 of file cycle_group.test.cpp.

◆ TYPED_TEST() [21/51]

TYPED_TEST ( CycleGroupTest  ,
TestConditionalAssignSuperMixupRegression   
)

Checks the bad behavior of conditional assign.

Definition at line 206 of file cycle_group.test.cpp.

◆ TYPED_TEST() [22/51]

TYPED_TEST ( CycleGroupTest  ,
TestConstantWitnessMixupRegression   
)

Checks the mixup bad behavior found by fuzzer.

Definition at line 167 of file cycle_group.test.cpp.

◆ TYPED_TEST() [23/51]

TYPED_TEST ( CycleGroupTest  ,
TestConstrainedUnconditionalAddFail   
)

Definition at line 825 of file cycle_group.test.cpp.

◆ TYPED_TEST() [24/51]

TYPED_TEST ( CycleGroupTest  ,
TestConstrainedUnconditionalAddSucceed   
)

Definition at line 806 of file cycle_group.test.cpp.

◆ TYPED_TEST() [25/51]

TYPED_TEST ( CycleGroupTest  ,
TestConstrainedUnconditionalSubtractFail   
)

Definition at line 1207 of file cycle_group.test.cpp.

◆ TYPED_TEST() [26/51]

TYPED_TEST ( CycleGroupTest  ,
TestConstrainedUnconditionalSubtractSucceed   
)

Definition at line 1188 of file cycle_group.test.cpp.

◆ TYPED_TEST() [27/51]

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 1735 of file cycle_group.test.cpp.

◆ TYPED_TEST() [28/51]

TYPED_TEST ( CycleGroupTest  ,
TestDbl   
)

Definition at line 381 of file cycle_group.test.cpp.

◆ TYPED_TEST() [29/51]

TYPED_TEST ( CycleGroupTest  ,
TestDblConstantPoints   
)

Definition at line 468 of file cycle_group.test.cpp.

◆ TYPED_TEST() [30/51]

TYPED_TEST ( CycleGroupTest  ,
TestDblMixedConstantWitness   
)

Definition at line 542 of file cycle_group.test.cpp.

◆ TYPED_TEST() [31/51]

TYPED_TEST ( CycleGroupTest  ,
TestDblNonConstantPoints   
)

Definition at line 410 of file cycle_group.test.cpp.

◆ TYPED_TEST() [32/51]

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 1851 of file cycle_group.test.cpp.

◆ TYPED_TEST() [33/51]

TYPED_TEST ( CycleGroupTest  ,
TestInfConstantWintnessRegression   
)

Checks that a point at infinity passes the constant_witness initialization.

Definition at line 96 of file cycle_group.test.cpp.

◆ TYPED_TEST() [34/51]

TYPED_TEST ( CycleGroupTest  ,
TestInfWintnessRegression   
)

Checks that a point at infinity passes the witness initialization.

Definition at line 112 of file cycle_group.test.cpp.

◆ TYPED_TEST() [35/51]

TYPED_TEST ( CycleGroupTest  ,
TestMul   
)

Definition at line 1669 of file cycle_group.test.cpp.

◆ TYPED_TEST() [36/51]

TYPED_TEST ( CycleGroupTest  ,
TestOne   
)

Definition at line 1719 of file cycle_group.test.cpp.

◆ TYPED_TEST() [37/51]

TYPED_TEST ( CycleGroupTest  ,
TestOperatorNegRegression   
)

Checks that adding operator-(value) to an existing value does not result into error.

Definition at line 147 of file cycle_group.test.cpp.

◆ TYPED_TEST() [38/51]

TYPED_TEST ( CycleGroupTest  ,
TestStandardForm   
)

Definition at line 301 of file cycle_group.test.cpp.

◆ TYPED_TEST() [39/51]

TYPED_TEST ( CycleGroupTest  ,
TestSubtract   
)

Definition at line 1225 of file cycle_group.test.cpp.

◆ TYPED_TEST() [40/51]

TYPED_TEST ( CycleGroupTest  ,
TestSubtractConstantPoints   
)

Definition at line 1323 of file cycle_group.test.cpp.

◆ TYPED_TEST() [41/51]

TYPED_TEST ( CycleGroupTest  ,
TestUnconditionalAdd   
)

Definition at line 778 of file cycle_group.test.cpp.

◆ TYPED_TEST() [42/51]

TYPED_TEST ( CycleGroupTest  ,
TestUnconditionalAddConstantPoints   
)

Definition at line 628 of file cycle_group.test.cpp.

◆ TYPED_TEST() [43/51]

TYPED_TEST ( CycleGroupTest  ,
TestUnconditionalAddNonConstantPoints   
)

Definition at line 567 of file cycle_group.test.cpp.

◆ TYPED_TEST() [44/51]

TYPED_TEST ( CycleGroupTest  ,
TestUnconditionalSubtract   
)

Definition at line 1159 of file cycle_group.test.cpp.

◆ TYPED_TEST() [45/51]

TYPED_TEST ( CycleGroupTest  ,
TestUnconditionalSubtractConstantPoints   
)

Definition at line 734 of file cycle_group.test.cpp.

◆ TYPED_TEST() [46/51]

TYPED_TEST ( CycleGroupTest  ,
TestUnconditionalSubtractNonConstantPoints   
)

Definition at line 672 of file cycle_group.test.cpp.

◆ TYPED_TEST() [47/51]

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 266 of file cycle_group.test.cpp.

◆ TYPED_TEST() [48/51]

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 286 of file cycle_group.test.cpp.

◆ TYPED_TEST() [49/51]

TYPED_TEST ( CycleGroupTest  ,
TestValidateOnCurveInfinitySucceed   
)

Checks that a point that is not on the curve but marked as the point at infinity passes the validate_on_curve check.

Should pass since marking it with _is_infinity=true makes whatever other point data invalid.

Definition at line 247 of file cycle_group.test.cpp.

◆ TYPED_TEST() [50/51]

TYPED_TEST ( CycleGroupTest  ,
TestValidateOnCurveSucceed   
)

Checks that a point on the curve passes the validate_on_curve check.

Definition at line 226 of file cycle_group.test.cpp.

◆ TYPED_TEST() [51/51]

TYPED_TEST ( CycleGroupTest  ,
TestWitnessSumRegression   
)

Checks that the result of adding two witness values is not constant.

Definition at line 128 of file cycle_group.test.cpp.

◆ TYPED_TEST_SUITE()

TYPED_TEST_SUITE ( CycleGroupTest  ,
CircuitTypes   
)