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);
76 [[maybe_unused]]
G1 a = G1::random_element(
engine);
79 for (
auto i = 0; i < 8; i++) {
80 op_queue->mul_accumulate(Curve::Group::affine_point_at_infinity, 0);
90 std::vector<FF>& gate_challenges)
94 const FF beta = FF::random_element();
95 const FF gamma = FF::random_element();
96 const FF beta_sqr = beta * beta;
97 relation_parameters.
gamma = gamma;
98 relation_parameters.
beta = beta;
99 relation_parameters.
beta_sqr = beta_sqr;
100 relation_parameters.
beta_cube = beta_sqr * beta;
102 gamma * (gamma + beta_sqr) * (gamma + beta_sqr + beta_sqr) * (gamma + beta_sqr + beta_sqr + beta_sqr);
105 const size_t unmasked_witness_size = pk->circuit_size - NUM_DISABLED_ROWS_IN_SUMCHECK;
107 compute_logderivative_inverse<FF, ECCVMFlavor::LookupRelation>(
108 pk->polynomials, relation_parameters, unmasked_witness_size);
109 compute_grand_products<ECCVMFlavor>(pk->polynomials, relation_parameters, unmasked_witness_size);
112 for (
size_t idx = 0; idx < CONST_ECCVM_LOG_N; idx++) {
113 gate_challenges[idx] = FF::random_element();
128 ASSERT_TRUE(verified);
159 ASSERT_TRUE(verified);
166 builder.op_queue->add_erroneous_equality_op_for_testing();
177 ASSERT_FALSE(verified);
189 std::vector<FF> gate_challenges(CONST_ECCVM_LOG_N);
198 const FF alpha = FF::random_element();
214 ZKData zk_sumcheck_data = ZKData(CONST_ECCVM_LOG_N, prover_transcript);
216 auto prover_output = sumcheck_prover.
prove(zk_sumcheck_data);
219 verifier_transcript->load_proof(prover_transcript->export_proof());
227 for (
size_t idx = 0; idx < CONST_ECCVM_LOG_N; idx++) {
228 FF true_eval_at_the_challenge = prover_output.round_univariates[idx].evaluate(prover_output.challenge[idx]);
230 EXPECT_TRUE(true_eval_at_the_challenge == verifier_eval_at_the_challenge);
234 FF prover_target_sum = zk_sumcheck_data.libra_challenge * zk_sumcheck_data.libra_total_sum;
239 EXPECT_TRUE(verifier_output.
verified);
267 auto labels = verifier.
key->get_labels();
269 for (
auto [vk_commitment, fixed_commitment] :
zip_view(vk_computed_by_prover.get_all(), fixed_vk.get_all())) {
270 EXPECT_EQ(vk_commitment, fixed_commitment)
271 <<
"Mismatch between vk_commitment and fixed_commitment at label: " << labels[index];
276 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)
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