Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ScalarMultiplicationSafeModeTest< Curve > Class Template Reference

Tests for pippenger safe mode (handle_edge_cases=true) which is used in native batch_mul. These tests verify that pippenger correctly handles scenarios that would fail with the unsafe affine variant: More...

Inheritance diagram for ScalarMultiplicationSafeModeTest< Curve >:

Public Types

using Group = typename Curve::Group
 
using Element = typename Curve::Element
 
using AffineElement = typename Curve::AffineElement
 
using ScalarField = typename Curve::ScalarField
 

Public Member Functions

void test_duplicate_points_helper (size_t num_pts)
 
void test_duplicate_points ()
 
void test_point_and_negation_helper (size_t num_pairs)
 
void test_point_and_negation ()
 
void test_mixed_duplicates_and_unique ()
 
void test_all_same_point_different_scalars ()
 
void test_empty_input ()
 
void test_zero_scalars ()
 
void test_all_zero_scalars ()
 
void test_points_at_infinity_in_input ()
 
void test_all_points_at_infinity ()
 

Static Public Member Functions

static void SetUpTestSuite ()
 

Static Public Attributes

static constexpr size_t num_points = 1000
 
static std::vector< AffineElementgenerators {}
 
static std::vector< ScalarFieldscalars {}
 

Detailed Description

template<class Curve>
class ScalarMultiplicationSafeModeTest< Curve >

Tests for pippenger safe mode (handle_edge_cases=true) which is used in native batch_mul. These tests verify that pippenger correctly handles scenarios that would fail with the unsafe affine variant:

  • Duplicate points (same point appears multiple times)
  • Point and its negation (P + (-P) = infinity) Tests cover sizes both below and above SINGLE_MUL_THRESHOLD (16), which is where the switch from naive small_mul to jacobian pippenger occurs.

Definition at line 22 of file scalar_multiplication_safe_mode.test.cpp.

Member Typedef Documentation

◆ AffineElement

template<class Curve >
using ScalarMultiplicationSafeModeTest< Curve >::AffineElement = typename Curve::AffineElement

Definition at line 26 of file scalar_multiplication_safe_mode.test.cpp.

◆ Element

Definition at line 25 of file scalar_multiplication_safe_mode.test.cpp.

◆ Group

template<class Curve >
using ScalarMultiplicationSafeModeTest< Curve >::Group = typename Curve::Group

Definition at line 24 of file scalar_multiplication_safe_mode.test.cpp.

◆ ScalarField

template<class Curve >
using ScalarMultiplicationSafeModeTest< Curve >::ScalarField = typename Curve::ScalarField

Definition at line 27 of file scalar_multiplication_safe_mode.test.cpp.

Member Function Documentation

◆ SetUpTestSuite()

template<class Curve >
static void ScalarMultiplicationSafeModeTest< Curve >::SetUpTestSuite ( )
inlinestatic

Definition at line 33 of file scalar_multiplication_safe_mode.test.cpp.

◆ test_all_points_at_infinity()

template<class Curve >
void ScalarMultiplicationSafeModeTest< Curve >::test_all_points_at_infinity ( )
inline

Definition at line 273 of file scalar_multiplication_safe_mode.test.cpp.

◆ test_all_same_point_different_scalars()

template<class Curve >
void ScalarMultiplicationSafeModeTest< Curve >::test_all_same_point_different_scalars ( )
inline

Definition at line 158 of file scalar_multiplication_safe_mode.test.cpp.

◆ test_all_zero_scalars()

template<class Curve >
void ScalarMultiplicationSafeModeTest< Curve >::test_all_zero_scalars ( )
inline

Definition at line 224 of file scalar_multiplication_safe_mode.test.cpp.

◆ test_duplicate_points()

template<class Curve >
void ScalarMultiplicationSafeModeTest< Curve >::test_duplicate_points ( )
inline

Definition at line 64 of file scalar_multiplication_safe_mode.test.cpp.

◆ test_duplicate_points_helper()

template<class Curve >
void ScalarMultiplicationSafeModeTest< Curve >::test_duplicate_points_helper ( size_t  num_pts)
inline

Definition at line 43 of file scalar_multiplication_safe_mode.test.cpp.

◆ test_empty_input()

template<class Curve >
void ScalarMultiplicationSafeModeTest< Curve >::test_empty_input ( )
inline

Definition at line 182 of file scalar_multiplication_safe_mode.test.cpp.

◆ test_mixed_duplicates_and_unique()

template<class Curve >
void ScalarMultiplicationSafeModeTest< Curve >::test_mixed_duplicates_and_unique ( )
inline

Definition at line 102 of file scalar_multiplication_safe_mode.test.cpp.

◆ test_point_and_negation()

template<class Curve >
void ScalarMultiplicationSafeModeTest< Curve >::test_point_and_negation ( )
inline

Definition at line 94 of file scalar_multiplication_safe_mode.test.cpp.

◆ test_point_and_negation_helper()

template<class Curve >
void ScalarMultiplicationSafeModeTest< Curve >::test_point_and_negation_helper ( size_t  num_pairs)
inline

Definition at line 72 of file scalar_multiplication_safe_mode.test.cpp.

◆ test_points_at_infinity_in_input()

template<class Curve >
void ScalarMultiplicationSafeModeTest< Curve >::test_points_at_infinity_in_input ( )
inline

Definition at line 243 of file scalar_multiplication_safe_mode.test.cpp.

◆ test_zero_scalars()

template<class Curve >
void ScalarMultiplicationSafeModeTest< Curve >::test_zero_scalars ( )
inline

Definition at line 194 of file scalar_multiplication_safe_mode.test.cpp.

Member Data Documentation

◆ generators

template<class Curve >
std::vector<AffineElement> ScalarMultiplicationSafeModeTest< Curve >::generators {}
inlinestatic

Definition at line 30 of file scalar_multiplication_safe_mode.test.cpp.

◆ num_points

template<class Curve >
constexpr size_t ScalarMultiplicationSafeModeTest< Curve >::num_points = 1000
staticconstexpr

Definition at line 29 of file scalar_multiplication_safe_mode.test.cpp.

◆ scalars

template<class Curve >
std::vector<ScalarField> ScalarMultiplicationSafeModeTest< Curve >::scalars {}
inlinestatic

Definition at line 31 of file scalar_multiplication_safe_mode.test.cpp.


The documentation for this class was generated from the following file: