20template <
bool IsRecursive_>
25 std::vector<Commitment> points(
N);
26 for (
size_t idx = 0; idx <
N; ++idx) {
27 points[idx] = _points[idx];
29 return Commitment::batch_mul(points, scalars);
32template <
bool IsRecursive_>
33template <
typename InstanceFlavor>
38 "InstanceFlavor recursive-ness must match the verifier's recursive-ness");
39 BB_BENCH_NAME(
"HypernovaFoldingVerifier::accumulate_instance");
42 proof.size(), InstanceFlavor::VIRTUAL_LOG_N);
44 auto sumcheck_output = sumcheck_on_incoming_instance<InstanceFlavor>(instance, proof, num_public_inputs);
45 cached_claims.emplace_back(sumcheck_output_to_accumulator<InstanceFlavor>(sumcheck_output, instance));
47 if (sumcheck_output.verified) {
48 vinfo(
"HypernovaFoldingVerifier: turned instance into accumulator.");
50 vinfo(
"HypernovaFoldingVerifier: instance-to-accumulator sumcheck failed. Ignore if generating VKs");
52 return sumcheck_output.verified;
55template <
bool IsRecursive_>
56template <
typename InstanceFlavor>
60 BB_BENCH_NAME(
"HypernovaFoldingVerifier::sumcheck_on_incoming_instance");
61 transcript->load_proof(proof);
66 instance->gate_challenges = transcript->template get_dyadic_powers_of_challenge<FF>(
67 "HypernovaFoldingProver:gate_challenge", InstanceFlavor::VIRTUAL_LOG_N);
70 return sumcheck.
verify(instance->relation_parameters, instance->gate_challenges);
73template <
bool IsRecursive_>
74template <
typename InstanceFlavor>
79 BB_BENCH_NAME(
"HypernovaFoldingVerifier::sumcheck_output_to_accumulator");
81 auto [unshifted_challenges, shifted_challenges] = get_hypernova_batching_challenges<FF>(
82 transcript, InstanceFlavor::NUM_UNSHIFTED_ENTITIES, InstanceFlavor::NUM_SHIFTED_ENTITIES);
84 FF batched_unshifted_evaluation(0);
85 FF batched_shifted_evaluation(0);
87 batched_unshifted_evaluation += eval * challenge;
90 batched_shifted_evaluation += eval * challenge;
96 Commitment batched_unshifted_commitment = batch_mul(verifier_commitments.get_unshifted(), unshifted_challenges);
97 Commitment batched_shifted_commitment = batch_mul(verifier_commitments.get_to_be_shifted(), shifted_challenges);
100 .non_shifted_evaluation = batched_unshifted_evaluation,
101 .shifted_evaluation = batched_shifted_evaluation,
102 .non_shifted_commitment = batched_unshifted_commitment,
103 .shifted_commitment = batched_shifted_commitment };
106template <
bool IsRecursive_>
113 claims.reserve((previous_accumulator.has_value() ? 1 : 0) + cached_claims.size());
114 if (previous_accumulator.has_value()) {
115 claims.emplace_back(
std::move(*previous_accumulator));
117 for (
auto& claim : cached_claims) {
120 cached_claims.clear();
121 BB_ASSERT(!claims.empty(),
"HypernovaFoldingVerifier::finalize: nothing to fold");
123 if (claims.size() == 1) {
127 transcript->load_proof(batching_proof);
#define BB_ASSERT(expression,...)
#define BB_BENCH_NAME(name)
Stateful HyperNova folding verifier (native + recursive). Verifies a series of instances against a st...
Commitment batch_mul(std::span< Commitment, N > _points, std::vector< FF > &scalars)
Utility to perform batch mul of commitments.
std::conditional_t< IsRecursive, stdlib::Proof< MegaCircuitBuilder >, HonkProof > Proof
bool accumulate_instance(const std::shared_ptr< VerifierInstance< InstanceFlavor > > &instance, const Proof &proof)
Verify the instance-to-accumulator sumcheck of one incoming proof and cache the resulting claim.
SumcheckOutput< InstanceFlavor > sumcheck_on_incoming_instance(const std::shared_ptr< VerifierInstance< InstanceFlavor > > &instance, const Proof &proof, size_t num_public_inputs)
Perform Oink + Sumcheck on the incoming instance, generating the challenges at which the polynomial c...
typename BaseFlavor::FF FF
typename BaseFlavor::Commitment Commitment
Public entrypoint for multilinear batching verification.
std::pair< bool, VerifierClaim > verify_proof(const std::vector< VerifierClaim > &claims)
Verifier counterpart to OinkProver: receives witness commitments, computes relation parameters,...
void verify(bool emit_alpha=true)
Receive witness commitments, compute relation parameters, and prepare for Sumcheck.
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...
typename VerifierCommitmentEntities< Flavor, Commitment >::Type Commitments
static Commitments construct(const std::shared_ptr< VerificationKey > &verification_key)
The VerifierInstance encapsulates all the necessary information for a Honk Verifier to verify a proof...
A simple wrapper around a vector of stdlib field elements representing a proof.
Entry point for Barretenberg command-line interface.
std::vector< fr > HonkProof
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Verifier's claim for multilinear batching - contains commitments and evaluation claims.
std::vector< FF > challenge
static size_t derive_num_public_inputs(size_t proof_size, size_t log_n)
Contains the evaluations of multilinear polynomials at the challenge point . These are computed by S...
ClaimedEvaluations claimed_evaluations
std::vector< FF > challenge