6#include <gtest/gtest.h>
24 size_t start_idx = selector.start_index();
25 size_t end_idx = selector.end_index();
27 size_t selector_enabled_idx{ 0 };
29 for (
size_t idx = start_idx; idx < end_idx; idx++) {
30 if (selector.at(idx) == 1) {
31 selector_enabled_idx = idx;
36 witness.at(selector_enabled_idx) += 1;
40 size_t start_idx = selector.start_index();
41 size_t end_idx = selector.end_index();
43 size_t selector_enabled_idx{ 0 };
45 for (
size_t idx = start_idx; idx < end_idx; idx++) {
46 if (selector.at(idx) == 1) {
47 selector_enabled_idx = idx;
51 const size_t round_size = external ? 4 : 56;
52 size_t shift_idx = selector_enabled_idx + round_size;
54 EXPECT_EQ(selector.at(shift_idx), 0);
57 witness.at(shift_idx) += 1;
72 complete_prover_instance_for_test<Flavor>(prover_instance);
77 SubrelationSeparator subrelation_separator = prover_transcript->template get_challenge<FF>(
"Sumcheck:alpha");
79 std::vector<FF> gate_challenges =
80 prover_transcript->template get_dyadic_powers_of_challenge<FF>(
"Sumcheck:gate_challenge", virtual_log_n);
83 prover_instance->gate_challenges = gate_challenges;
86 prover_instance->polynomials,
88 subrelation_separator,
90 prover_instance->relation_parameters,
92 auto proof = sumcheck_prover.
prove();
97 verifier_transcript->template get_challenge<FF>(
"Sumcheck:alpha");
98 std::vector<FF> verifier_gate_challenges =
99 verifier_transcript->template get_dyadic_powers_of_challenge<FF>(
"Sumcheck:gate_challenge", virtual_log_n);
102 SumcheckVerifier verifier(verifier_transcript, verifier_subrelation_separator, virtual_log_n);
103 auto result = verifier.
verify(prover_instance->relation_parameters, verifier_gate_challenges);
119 prove_and_verify(prover_instance,
true);
130 modify_witness(prover_instance->polynomials.q_poseidon2_external, prover_instance->polynomials.w_l);
131 prove_and_verify(prover_instance,
false);
134 modify_witness(prover_instance->polynomials.q_poseidon2_internal, prover_instance->polynomials.w_r);
135 prove_and_verify(prover_instance,
false);
147 bool external_round =
true;
149 prover_instance->polynomials.q_poseidon2_external, prover_instance->polynomials.w_l, external_round);
150 prove_and_verify(prover_instance,
false);
154 bool external_round =
false;
156 prover_instance->polynomials.q_poseidon2_internal, prover_instance->polynomials.w_l, external_round);
157 prove_and_verify(prover_instance,
false);
void tamper_with_shifts(const auto &selector, auto &witness, bool external)
void modify_witness(const auto &selector, auto &witness)
void prove_and_verify(std::shared_ptr< ProverInstance > &prover_instance, bool expected_result)
void hash_single_input(Builder &builder)
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
static std::shared_ptr< BaseTranscript > test_prover_init_empty()
For testing: initializes transcript with some arbitrary data so that a challenge can be generated aft...
static std::shared_ptr< BaseTranscript > test_verifier_init_empty(const std::shared_ptr< BaseTranscript > &transcript)
For testing: initializes transcript based on proof data then receives junk data produced by BaseTrans...
Contains all the information required by a Honk prover to create a proof, constructed from a finalize...
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, const std::vector< FF > &gate_challenges)
The Sumcheck verification method. First it extracts round univariate, checks sum (the sumcheck univar...
BaseTranscript< Codec, HashFunction > Transcript
UltraCircuitBuilder CircuitBuilder
static constexpr size_t VIRTUAL_LOG_N
static FF hash(const std::vector< FF > &input)
Hashes a vector of field elements.
Entry point for Barretenberg command-line interface.
TEST_F(IPATest, ChallengesAreZero)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
static field random_element(numeric::RNG *engine=nullptr) noexcept