|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include "sumcheck_round.hpp"#include "barretenberg/circuit_checker/circuit_checker.hpp"#include "barretenberg/common/tuple.hpp"#include "barretenberg/flavor/mega_flavor.hpp"#include "barretenberg/flavor/mega_zk_flavor.hpp"#include "barretenberg/flavor/multilinear_batching_flavor.hpp"#include "barretenberg/flavor/sumcheck_test_flavor.hpp"#include "barretenberg/flavor/ultra_flavor.hpp"#include "barretenberg/flavor/ultra_recursive_flavor.hpp"#include "barretenberg/flavor/ultra_zk_flavor.hpp"#include "barretenberg/relations/utils.hpp"#include <gtest/gtest.h>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) | |
| using RowParallelFlavors = ::testing::Types<MegaFlavor, MegaZKFlavor, UltraFlavor, UltraZKFlavor> |
Definition at line 1031 of file sumcheck_round.test.cpp.
| 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.
| zero_entity_indices | entities 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 | ( | SumcheckRound | , |
| AccumulateRelationUnivariatesSumcheckTestFlavor | |||
| ) |
Test accumulate_relation_univariates for SumcheckTestFlavor.
Tests that:
Definition at line 481 of file sumcheck_round.test.cpp.
| 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 | ( | 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 | ( | 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 | ( | 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 | ( | 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 | ( | 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 | ( | 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 | ( | 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 | ( | SumcheckRound | , |
| RowParallelSkipFiresMatchesScalarMega | |||
| ) |
Definition at line 1042 of file sumcheck_round.test.cpp.
| 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 | ( | 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 | ( | RowParallelParity | , |
| MatchesScalar | |||
| ) |
Definition at line 1034 of file sumcheck_round.test.cpp.
| TYPED_TEST_SUITE | ( | RowParallelParity | , |
| RowParallelFlavors | |||
| ) |