11template <
typename Flavor_>
16 std::vector<std::string> labels_unshifted_entities(NUM_UNSHIFTED_ENTITIES);
17 std::vector<std::string> labels_shifted_witnesses(NUM_SHIFTED_ENTITIES);
18 for (
size_t idx = 0; idx < NUM_UNSHIFTED_ENTITIES; idx++) {
19 labels_unshifted_entities[idx] =
"unshifted_challenge_" +
std::to_string(idx);
21 for (
size_t idx = 0; idx < NUM_SHIFTED_ENTITIES; idx++) {
22 labels_shifted_witnesses[idx] =
"shifted_challenge_" +
std::to_string(idx);
24 auto unshifted_challenges = transcript->template get_challenges<FF>(labels_unshifted_entities);
25 auto shifted_challenges = transcript->template get_challenges<FF>(labels_shifted_witnesses);
27 return { unshifted_challenges, shifted_challenges };
30template <
typename Flavor_>
35 std::vector<Commitment> points(N);
36 for (
size_t idx = 0;
const auto& point : _points) {
37 points[idx++] = point;
41 return Curve::Group::batch_mul(points, scalars);
43 return batch_mul_native<Curve>(points, scalars);
47template <
typename Flavor>
52 BB_BENCH_NAME(
"HypernovaFoldingVerifier::sumcheck_output_to_accumulator");
55 auto [unshifted_challenges, shifted_challenges] = get_batching_challenges();
58 FF batched_unshifted_evaluation(0);
59 FF batched_shifted_evaluation(0);
62 batched_unshifted_evaluation += eval * challenge;
65 batched_shifted_evaluation += eval * challenge;
71 Commitment batched_unshifted_commitment = batch_mul(verifier_commitments.get_unshifted(), unshifted_challenges);
75 .non_shifted_evaluation = batched_unshifted_evaluation,
76 .shifted_evaluation = batched_shifted_evaluation,
77 .non_shifted_commitment = batched_unshifted_commitment,
78 .shifted_commitment = batched_shifted_commitment };
81template <
typename Flavor>
85 BB_BENCH_NAME(
"HypernovaFoldingVerifier::sumcheck_on_incoming_instance");
87 vinfo(
"HypernovaFoldingVerifier: verifying Oink proof...");
90 transcript->load_proof(proof);
93 instance->gate_challenges = transcript->template get_dyadic_powers_of_challenge<FF>(
94 "HypernovaFoldingProver:gate_challenge", Flavor::VIRTUAL_LOG_N);
97 vinfo(
"HypernovaFoldingVerifier: verifying Sumcheck to turn instance into an accumulator...");
99 std::vector<FF> padding_indicator_array(Flavor::VIRTUAL_LOG_N, 1);
104 return sumcheck_output;
107template <
typename Flavor>
112 BB_BENCH_NAME(
"HypernovaFoldingVerifier::instance_to_accumulator");
114 auto sumcheck_output = sumcheck_on_incoming_instance(
instance, proof);
116 auto accumulator = sumcheck_output_to_accumulator(sumcheck_output,
instance);
118 if (sumcheck_output.verified) {
119 vinfo(
"HypernovaFoldingVerifier: Successfully turned instance into accumulator.");
121 vinfo(
"HypernovaFoldingVerifier: Failed to recursively verify Sumcheck to turn instance into an accumulator. "
122 "Ignore if generating the VKs");
125 return { sumcheck_output.verified, accumulator };
128template <
typename Flavor>
133 BB_BENCH_NAME(
"HypernovaFoldingVerifier::verify_folding_proof");
135 vinfo(
"HypernovaFoldingVerifier: verifying folding proof...");
137 auto sumcheck_output = sumcheck_on_incoming_instance(
instance, proof);
140 auto [unshifted_challenges, shifted_challenges] = get_batching_challenges();
145 auto [sumcheck_batching_result, new_accumulator] =
146 batching_verifier.verify_proof(sumcheck_output, verifier_commitments, unshifted_challenges, shifted_challenges);
148 if (sumcheck_output.verified && sumcheck_batching_result) {
149 vinfo(
"HypernovaFoldingVerifier: successfully verified folding proof.");
150 }
else if (!sumcheck_output.verified) {
151 vinfo(
"HypernovaFoldingVerifier: Failed to recursively verify Sumcheck to turn instance into an accumulator. "
152 "Ignore if generating the VKs");
154 vinfo(
"HypernovaFoldingVerifier: Failed to recursively verify Sumcheck to batch two accumulators. Ignore if "
155 "generating the VKs");
158 return { sumcheck_output.verified, sumcheck_batching_result, new_accumulator };
std::shared_ptr< Napi::ThreadSafeFunction > instance
#define BB_BENCH_NAME(name)
SumcheckOutput< Flavor > sumcheck_on_incoming_instance(const std::shared_ptr< VerifierInstance > &instance, const Proof &proof)
Perform sumcheck on the incoming instance.
std::conditional_t< IsRecursiveFlavor< Flavor >, typename HypernovaRecursiveTypes::Proof, typename HypernovaNativeTypes::Proof > Proof
Flavor::Commitment Commitment
std::pair< bool, Accumulator > instance_to_accumulator(const std::shared_ptr< VerifierInstance > &instance, const Proof &proof)
Turn an instance into an accumulator by executing sumcheck.
std::conditional_t< IsRecursiveFlavor< Flavor >, typename HypernovaRecursiveTypes::MultilinearBatchingVerifier, typename HypernovaNativeTypes::MultilinearBatchingVerifier > MultilinearBatchingVerifier
Commitment batch_mul(const RefArray< Commitment, N > &_points, const std::vector< FF > &scalars)
Utility to perform batch mul of commitments.
Accumulator sumcheck_output_to_accumulator(MegaSumcheckOutput &sumcheck_output, const std::shared_ptr< VerifierInstance > &instance)
Convert the output of the sumcheck run on the incoming instance into an accumulator.
std::pair< std::vector< FF >, std::vector< FF > > get_batching_challenges()
Generate the challenges required to batch the incoming instance with the accumulator.
Verifier class for all the presumcheck rounds, which are shared between the folding verifier and ultr...
void verify()
Oink Verifier function that runs all the rounds of the verifier.
A template class for a reference array. Behaves as if std::array<T&, N> was possible.
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, const std::vector< FF > &padding_indicator_array)
The Sumcheck verification method. First it extracts round univariate, checks sum (the sumcheck univar...
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::string to_string(bb::avm2::ValueTag tag)
std::vector< FF > challenge
Contains the evaluations of multilinear polynomials at the challenge point . These are computed by S...
ClaimedEvaluations claimed_evaluations
std::vector< FF > challenge