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

Go to the source code of this file.

Classes

class  RowParallelParity< Flavor >
 

Typedefs

using RowParallelFlavors = ::testing::Types< MegaFlavor, MegaZKFlavor, UltraFlavor, UltraZKFlavor >
 

Functions

 TEST (SumcheckRound, SumcheckTupleOfTuplesOfUnivariates)
 Test SumcheckRound functions for operations on tuples (and tuples of tuples) of Univariates.
 
 TEST (SumcheckRound, TuplesOfEvaluationArrays)
 Test utility functions for applying operations to tuple of std::arrays of field elements.
 
 TEST (SumcheckRound, AddTuplesOfTuplesOfUnivariates)
 Test utility functions for adding two tuples of tuples of Univariates.
 
 TEST (SumcheckRound, ComputeEffectiveRoundSize)
 Test compute_effective_round_size optimization for non-ZK flavors.
 
 TEST (SumcheckRound, ComputeEffectiveRoundSizeZK)
 Test that compute_effective_round_size excludes disabled rows for ZK flavors.
 
 TEST (SumcheckRound, ExtendEdgesShortMonomial)
 Test that extend_edges works correctly in the cases we're using ShortMonomials.
 
 TEST (SumcheckRound, ExtendEdges)
 Test extend_edges with full barycentric extension (non-short-monomial flavor)
 
 TEST (SumcheckRound, AccumulateRelationUnivariatesSumcheckTestFlavor)
 Test accumulate_relation_univariates for SumcheckTestFlavor.
 
 TEST (SumcheckRound, CheckSumFieldArithmetic)
 Test check_sum with field arithmetic edge cases.
 
 TEST (SumcheckRound, CheckSumRoundFailurePersistence)
 Test round_failed flag persistence in check_sum.
 
 TEST (SumcheckRound, CheckSumRecursiveUnsatisfiableWitness)
 Test check_sum in a recursive circuit with unsatisfiable witness.
 
template<typename Flavor >
void check_row_parallel_matches_scalar (const std::vector< size_t > &zero_entity_indices={})
 The row-parallel main-loop contribution must equal the scalar path bit-for-bit.
 
 TYPED_TEST_SUITE (RowParallelParity, RowParallelFlavors)
 
 TYPED_TEST (RowParallelParity, MatchesScalar)
 
 TEST (SumcheckRound, RowParallelSkipFiresMatchesScalarMega)
 

Typedef Documentation

◆ RowParallelFlavors

Definition at line 1031 of file sumcheck_round.test.cpp.

Function Documentation

◆ check_row_parallel_matches_scalar()

template<typename Flavor >
void check_row_parallel_matches_scalar ( const std::vector< size_t > &  zero_entity_indices = {})

The row-parallel main-loop contribution must equal the scalar path bit-for-bit.

Runs compute_univariate<FF> and compute_univariate<VectorField<FF::Params>> over the same random prover polynomials and asserts equal SumcheckRoundUnivariate. On native, VectorField is the scalar fallback, so this exercises only the lane orchestration (stride-2 gather, per-lane gate-separator gather, horizontal reduce, scalar tail); the SIMD arithmetic itself is covered by VectorFieldTest on WASM and end-to-end by the WASM proving tests.

ZK flavors: the ZK offset-area / Libra contributions are added on top by sumcheck.hpp, so they sit outside compute_univariate's return value. Both lanes honour excluded_head_size, so main-loop contributions must match for ZK too.

round_size = 32 covers multiple full 10-row SIMD batches plus a non-empty scalar tail.

Parameters
zero_entity_indicesentities to zero instead of randomizing. Zeroing a relation's gating selector makes its skip() fire on every batch (row-parallel) and every row (scalar); the two must still agree.

Definition at line 969 of file sumcheck_round.test.cpp.

◆ TEST() [1/12]

TEST ( SumcheckRound  ,
AccumulateRelationUnivariatesSumcheckTestFlavor   
)

Test accumulate_relation_univariates for SumcheckTestFlavor.

Tests that:

  1. Arithmetic relation contributions are correctly accumulated
  2. Scaling factors are properly applied
  3. Multiple calls correctly accumulate (add) contributions

Definition at line 481 of file sumcheck_round.test.cpp.

◆ TEST() [2/12]

TEST ( SumcheckRound  ,
AddTuplesOfTuplesOfUnivariates   
)

Test utility functions for adding two tuples of tuples of Univariates.

Definition at line 118 of file sumcheck_round.test.cpp.

◆ TEST() [3/12]

TEST ( SumcheckRound  ,
CheckSumFieldArithmetic   
)

Test check_sum with field arithmetic edge cases.

Verifies that check_sum works correctly with large field elements near the modulus

Definition at line 689 of file sumcheck_round.test.cpp.

◆ TEST() [4/12]

TEST ( SumcheckRound  ,
CheckSumRecursiveUnsatisfiableWitness   
)

Test check_sum in a recursive circuit with unsatisfiable witness.

Creates a recursive circuit where check_sum is called with witnesses that don't satisfy the constraint, verifying that the circuit correctly detects the failure.

Definition at line 821 of file sumcheck_round.test.cpp.

◆ TEST() [5/12]

TEST ( SumcheckRound  ,
CheckSumRoundFailurePersistence   
)

Test round_failed flag persistence in check_sum.

Verifies that once a check fails, the round_failed flag persists across subsequent checks

Definition at line 756 of file sumcheck_round.test.cpp.

◆ TEST() [6/12]

TEST ( SumcheckRound  ,
ComputeEffectiveRoundSize   
)

Test compute_effective_round_size optimization for non-ZK flavors.

This function optimizes sumcheck iteration by only processing up to the active witness region, avoiding iteration over trailing zeros when HasZK is false.

Definition at line 154 of file sumcheck_round.test.cpp.

◆ TEST() [7/12]

TEST ( SumcheckRound  ,
ComputeEffectiveRoundSizeZK   
)

Test that compute_effective_round_size excludes disabled rows for ZK flavors.

For ZK flavors, we always cap at round_size - 2 (disabled rows are handled separately via compute_offset_area_contribution)

Definition at line 319 of file sumcheck_round.test.cpp.

◆ TEST() [8/12]

TEST ( SumcheckRound  ,
ExtendEdges   
)

Test extend_edges with full barycentric extension (non-short-monomial flavor)

Uses a flavor with USE_SHORT_MONOMIALS=false to test that the barycentric extension to MAX_PARTIAL_RELATION_LENGTH works correctly.

Definition at line 411 of file sumcheck_round.test.cpp.

◆ TEST() [9/12]

TEST ( SumcheckRound  ,
ExtendEdgesShortMonomial   
)

Test that extend_edges works correctly in the cases we're using ShortMonomials.

Verifies that the barycentric extension preserves the univariate property: the extended univariate should be a degree-1 polynomial that passes through the two given points.

Definition at line 352 of file sumcheck_round.test.cpp.

◆ TEST() [10/12]

TEST ( SumcheckRound  ,
RowParallelSkipFiresMatchesScalarMega   
)

Definition at line 1042 of file sumcheck_round.test.cpp.

◆ TEST() [11/12]

TEST ( SumcheckRound  ,
SumcheckTupleOfTuplesOfUnivariates   
)

Test SumcheckRound functions for operations on tuples (and tuples of tuples) of Univariates.

Definition at line 21 of file sumcheck_round.test.cpp.

◆ TEST() [12/12]

TEST ( SumcheckRound  ,
TuplesOfEvaluationArrays   
)

Test utility functions for applying operations to tuple of std::arrays of field elements.

Definition at line 76 of file sumcheck_round.test.cpp.

◆ TYPED_TEST()

TYPED_TEST ( RowParallelParity  ,
MatchesScalar   
)

Definition at line 1034 of file sumcheck_round.test.cpp.

◆ TYPED_TEST_SUITE()

TYPED_TEST_SUITE ( RowParallelParity  ,
RowParallelFlavors   
)