3#include <gtest/gtest.h>
50 op_queue->add_accumulate(
a);
51 op_queue->mul_accumulate(
a, x);
52 op_queue->mul_accumulate(
b, x);
53 op_queue->mul_accumulate(
b, y);
54 op_queue->add_accumulate(
a);
55 op_queue->mul_accumulate(
b, x);
56 op_queue->eq_and_reset();
57 op_queue->add_accumulate(c);
58 op_queue->mul_accumulate(
a, x);
59 op_queue->mul_accumulate(
b, x);
60 op_queue->eq_and_reset();
61 op_queue->mul_accumulate(
a, x);
62 op_queue->mul_accumulate(
b, x);
63 op_queue->mul_accumulate(c, x);
80 for (
auto i = 0; i < 8; i++) {
82 op_queue->mul_accumulate(Curve::Group::affine_point_at_infinity, x);
85 for (
auto i = 0; i < 8; i++) {
87 op_queue->mul_accumulate(g, 0);
98 std::vector<FF>& gate_challenges)
102 const FF beta = FF::random_element();
103 const FF gamma = FF::random_element();
104 const FF beta_sqr = beta * beta;
105 relation_parameters.
gamma = gamma;
106 relation_parameters.
beta = beta;
107 relation_parameters.
beta_sqr = beta_sqr;
108 relation_parameters.
beta_cube = beta_sqr * beta;
110 gamma * (gamma + beta_sqr) * (gamma + beta_sqr + beta_sqr) * (gamma + beta_sqr + beta_sqr + beta_sqr);
113 const size_t unmasked_witness_size = pk->circuit_size - NUM_DISABLED_ROWS_IN_SUMCHECK;
115 compute_logderivative_inverse<FF, ECCVMFlavor::LookupRelation>(
116 pk->polynomials, relation_parameters, unmasked_witness_size);
117 compute_grand_products<ECCVMFlavor>(pk->polynomials, relation_parameters, unmasked_witness_size);
120 for (
size_t idx = 0; idx < CONST_ECCVM_LOG_N; idx++) {
121 gate_challenges[idx] = FF::random_element();
136 ASSERT_TRUE(verified);
150 ASSERT_TRUE(verified);
162 op_queue->eq_and_reset();
174 ASSERT_TRUE(verified);
205 ASSERT_TRUE(verified);
212 builder.op_queue->add_erroneous_equality_op_for_testing();
223 ASSERT_FALSE(verified);
235 std::vector<FF> gate_challenges(CONST_ECCVM_LOG_N);
244 const FF alpha = FF::random_element();
260 ZKData zk_sumcheck_data = ZKData(CONST_ECCVM_LOG_N, prover_transcript);
262 auto prover_output = sumcheck_prover.
prove(zk_sumcheck_data);
265 verifier_transcript->load_proof(prover_transcript->export_proof());
273 for (
size_t idx = 0; idx < CONST_ECCVM_LOG_N; idx++) {
274 FF true_eval_at_the_challenge = prover_output.round_univariates[idx].evaluate(prover_output.challenge[idx]);
276 EXPECT_TRUE(true_eval_at_the_challenge == verifier_eval_at_the_challenge);
280 FF prover_target_sum = zk_sumcheck_data.libra_challenge * zk_sumcheck_data.libra_total_sum;
285 EXPECT_TRUE(verifier_output.
verified);
313 auto labels = verifier.
key->get_labels();
315 for (
auto [vk_commitment, fixed_commitment] :
zip_view(vk_computed_by_prover.get_all(), fixed_vk.get_all())) {
316 EXPECT_EQ(vk_commitment, fixed_commitment)
317 <<
"Mismatch between vk_commitment and fixed_commitment at label: " << labels[index];
322 EXPECT_EQ(fixed_vk, vk_computed_by_prover);
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
The proving key is responsible for storing the polynomials used by the prover.
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
VerifierCommitmentKey pcs_verification_key
typename Curve::ScalarField FF
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS
NativeTranscript Transcript
ECCVMProof construct_proof()
std::shared_ptr< ProvingKey > key
bool verify_proof(const ECCVMProof &proof)
This function verifies an ECCVM Honk proof for given program settings.
std::shared_ptr< VerificationKey > key
NativeTranscript Transcript
The implementation of the sumcheck Prover for statements of the form for multilinear polynomials .
SumcheckOutput< Flavor > prove()
Non-ZK version: Compute round univariate, place it in transcript, compute challenge,...
Implementation of the sumcheck Verifier for statements of the form for multilinear polynomials .
SumcheckOutput< Flavor > verify(const bb::RelationParameters< FF > &relation_parameters, std::vector< FF > &gate_challenges, const std::vector< FF > &padding_indicator_array)
Extract round univariate, check sum, generate challenge, compute next target sum.....
Representation of the Grumpkin Verifier Commitment Key inside a bn254 circuit.
typename Group::element Element
void complete_proving_key_for_test(bb::RelationParameters< FF > &relation_parameters, std::shared_ptr< PK > &pk, std::vector< FF > &gate_challenges)
ECCVMCircuitBuilder generate_zero_circuit(numeric::RNG *engine=nullptr, bool zero_scalars=1)
ECCVMCircuitBuilder generate_circuit(numeric::RNG *engine=nullptr)
Adds operations in BN254 to the op_queue and then constructs and ECCVM circuit from the op_queue.
RNG & get_debug_randomness(bool reset, std::uint_fast64_t seed)
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
Entry point for Barretenberg command-line interface.
TEST_F(IPATest, ChallengesAreZero)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Container for parameters used by the grand product (permutation, lookup) Honk relations.
T eccvm_set_permutation_delta
Contains the evaluations of multilinear polynomials at the challenge point . These are computed by S...
std::vector< std::array< FF, 3 > > round_univariate_evaluations
This structure is created to contain various polynomials and constants required by ZK Sumcheck.
static field random_element(numeric::RNG *engine=nullptr) noexcept