Barretenberg
The ZK-SNARK library at the core of Aztec
|
This structure is created to contain various polynomials and constants required by ZK Sumcheck. More...
#include <zk_sumcheck_data.hpp>
Public Types | |
using | Curve = typename Flavor::Curve |
using | FF = typename Curve::ScalarField |
using | ClaimedLibraEvaluations = std::vector< FF > |
Public Member Functions | |
ZKSumcheckData ()=default | |
ZKSumcheckData (const size_t multivariate_d, std::shared_ptr< typename Flavor::Transcript > transcript=nullptr, const typename Flavor::CommitmentKey &commitment_key=typename Flavor::CommitmentKey()) | |
ZKSumcheckData (const size_t multivariate_d, const size_t univariate_length) | |
For test purposes: Constructs a sumcheck instance from the polynomial \( g + \sum_{i=0}^d g_i(X_i)\), where \( g_i \) is a random univariate of a given length and \( g\) is a random constant term. | |
void | create_interpolation_domain () |
Create a interpolation domain object and initialize the evaluation domain in the case of BN254 scalar field. | |
void | compute_concatenated_libra_polynomial () |
Compute concatenated libra polynomial in lagrange basis, transform to monomial, add masking term Z_H(m_0. | |
void | update_zk_sumcheck_data (const FF &round_challenge, const size_t round_idx) |
Upon receiving the challenge \(u_i\), the prover updates Libra data. If \( i < d-1\). | |
Static Public Member Functions | |
static std::vector< Polynomial< FF > > | generate_libra_univariates (const size_t number_of_polynomials, const size_t univariate_length) |
Given number of univariate polynomials and the number of their evaluations meant to be hidden, this method produces a vector of univariate polynomials of length Flavor::BATCHED_RELATION_PARTIAL_LENGTH with independent uniformly random coefficients. | |
static FF | compute_libra_total_sum (const std::vector< Polynomial< FF > > &libra_univariates, FF &scaling_factor, const FF &constant_term) |
Compute the sum of the randomly sampled multivariate polynomial \( G = \sum_{i=0}^{n-1} g_i(X_i) \) over the Boolean hypercube. | |
static void | setup_auxiliary_data (auto &libra_univariates, FF &libra_scaling_factor, const FF &libra_challenge, FF &libra_running_sum) |
Set up Libra book-keeping table that simplifies the computation of Libra Round Univariates. | |
Public Attributes | |
FF | constant_term |
EvaluationDomain< FF > | bn_evaluation_domain = EvaluationDomain<FF>() |
std::array< FF, SUBGROUP_SIZE > | interpolation_domain |
Polynomial< FF > | libra_concatenated_lagrange_form |
Polynomial< FF > | libra_concatenated_monomial_form |
std::vector< Polynomial< FF > > | libra_univariates {} |
size_t | log_circuit_size { 0 } |
FF | libra_scaling_factor { 1 } |
FF | libra_challenge |
FF | libra_total_sum |
FF | libra_running_sum |
ClaimedLibraEvaluations | libra_evaluations |
size_t | univariate_length |
Static Public Attributes | |
static constexpr size_t | SUBGROUP_SIZE = Curve::SUBGROUP_SIZE |
static constexpr FF | subgroup_generator = Curve::subgroup_generator |
static constexpr size_t | LIBRA_UNIVARIATES_LENGTH = Curve::LIBRA_UNIVARIATES_LENGTH |
static constexpr FF | one_half = FF(1) / FF(2) |
This structure is created to contain various polynomials and constants required by ZK Sumcheck.
Definition at line 22 of file zk_sumcheck_data.hpp.
using bb::ZKSumcheckData< Flavor >::ClaimedLibraEvaluations = std::vector<FF> |
Definition at line 36 of file zk_sumcheck_data.hpp.
using bb::ZKSumcheckData< Flavor >::Curve = typename Flavor::Curve |
Definition at line 23 of file zk_sumcheck_data.hpp.
using bb::ZKSumcheckData< Flavor >::FF = typename Curve::ScalarField |
Definition at line 24 of file zk_sumcheck_data.hpp.
|
default |
|
inline |
Definition at line 59 of file zk_sumcheck_data.hpp.
|
inline |
For test purposes: Constructs a sumcheck instance from the polynomial \( g + \sum_{i=0}^d g_i(X_i)\), where \( g_i \) is a random univariate of a given length and \( g\) is a random constant term.
To test Shplemini with commitments to Sumcheck Round Univariates, we need to create valid Sumcheck Round Univariates. Fortunately, the functionality of ZKSumcheckData could be re-used for this purpose.
multivariate_d | |
univariate_length |
Definition at line 105 of file zk_sumcheck_data.hpp.
|
inline |
Compute concatenated libra polynomial in lagrange basis, transform to monomial, add masking term Z_H(m_0.
Definition at line 209 of file zk_sumcheck_data.hpp.
|
inlinestatic |
Compute the sum of the randomly sampled multivariate polynomial \( G = \sum_{i=0}^{n-1} g_i(X_i) \) over the Boolean hypercube.
libra_univariates | |
scaling_factor |
Definition at line 143 of file zk_sumcheck_data.hpp.
|
inline |
Create a interpolation domain object and initialize the evaluation domain in the case of BN254 scalar field.
Definition at line 190 of file zk_sumcheck_data.hpp.
|
inlinestatic |
Given number of univariate polynomials and the number of their evaluations meant to be hidden, this method produces a vector of univariate polynomials of length Flavor::BATCHED_RELATION_PARTIAL_LENGTH with independent uniformly random coefficients.
Definition at line 124 of file zk_sumcheck_data.hpp.
|
inlinestatic |
Set up Libra book-keeping table that simplifies the computation of Libra Round Univariates.
The array of Libra univariates is getting scaled
\begin{align}\texttt{libra_univariates} \gets \texttt{libra_univariates}\cdot \rho \cdot 2^{d-1}\end{align}
We also initialize
\begin{align} \texttt{libra_running_sum} \gets \texttt{libra_total_sum} - \texttt{libra_univariates}_{0,0} - \texttt{libra_univariates}_{0,1} \end{align}
.
libra_table | |
libra_round_factor | |
libra_challenge |
Definition at line 171 of file zk_sumcheck_data.hpp.
|
inline |
Upon receiving the challenge \(u_i\), the prover updates Libra data. If \( i < d-1\).
\begin{align} \texttt{libra_running_sum} \gets 2^{d-i-2} \cdot \texttt{libra_challenge} \cdot g_0(u_0) + 2^{-1} \cdot \left( \texttt{libra_running_sum} - (\texttt{libra_univariates}_{i+1}(0) + \texttt{libra_univariates}_{i+1}(1)) \right) \end{align}
If \( i = d-1\)libra_univariates | |
round_challenge | |
round_idx | |
libra_running_sum | |
libra_evaluations |
Definition at line 275 of file zk_sumcheck_data.hpp.
EvaluationDomain<FF> bb::ZKSumcheckData< Flavor >::bn_evaluation_domain = EvaluationDomain<FF>() |
Definition at line 40 of file zk_sumcheck_data.hpp.
FF bb::ZKSumcheckData< Flavor >::constant_term |
Definition at line 38 of file zk_sumcheck_data.hpp.
std::array<FF, SUBGROUP_SIZE> bb::ZKSumcheckData< Flavor >::interpolation_domain |
Definition at line 41 of file zk_sumcheck_data.hpp.
FF bb::ZKSumcheckData< Flavor >::libra_challenge |
Definition at line 49 of file zk_sumcheck_data.hpp.
Polynomial<FF> bb::ZKSumcheckData< Flavor >::libra_concatenated_lagrange_form |
Definition at line 43 of file zk_sumcheck_data.hpp.
Polynomial<FF> bb::ZKSumcheckData< Flavor >::libra_concatenated_monomial_form |
Definition at line 44 of file zk_sumcheck_data.hpp.
ClaimedLibraEvaluations bb::ZKSumcheckData< Flavor >::libra_evaluations |
Definition at line 52 of file zk_sumcheck_data.hpp.
FF bb::ZKSumcheckData< Flavor >::libra_running_sum |
Definition at line 51 of file zk_sumcheck_data.hpp.
FF bb::ZKSumcheckData< Flavor >::libra_scaling_factor { 1 } |
Definition at line 48 of file zk_sumcheck_data.hpp.
FF bb::ZKSumcheckData< Flavor >::libra_total_sum |
Definition at line 50 of file zk_sumcheck_data.hpp.
std::vector<Polynomial<FF> > bb::ZKSumcheckData< Flavor >::libra_univariates {} |
Definition at line 46 of file zk_sumcheck_data.hpp.
|
staticconstexpr |
Definition at line 31 of file zk_sumcheck_data.hpp.
size_t bb::ZKSumcheckData< Flavor >::log_circuit_size { 0 } |
Definition at line 47 of file zk_sumcheck_data.hpp.
|
staticconstexpr |
Definition at line 33 of file zk_sumcheck_data.hpp.
|
staticconstexpr |
Definition at line 28 of file zk_sumcheck_data.hpp.
|
staticconstexpr |
Definition at line 26 of file zk_sumcheck_data.hpp.
size_t bb::ZKSumcheckData< Flavor >::univariate_length |
Definition at line 54 of file zk_sumcheck_data.hpp.