29 return static_cast<size_t>(Flavor::VIRTUAL_LOG_N);
32 const size_t log_circuit_size =
static_cast<size_t>(verifier_instance->get_vk()->log_circuit_size);
34 log_circuit_size,
static_cast<size_t>(1),
"VK log_circuit_size is 0, which is invalid for any circuit");
35 return log_circuit_size;
55template <
typename Flavor,
class IO>
58 IO>::split_rollup_proof(
const Proof& combined_proof)
const
64 "Combined rollup proof is too small to contain IPA proof. Expected at least " +
68 const auto honk_proof_length =
static_cast<std::ptrdiff_t>(combined_proof.size() - IPA_PROOF_LENGTH);
70 Proof honk_proof(combined_proof.begin(), combined_proof.begin() + honk_proof_length);
71 Proof ipa_proof(combined_proof.begin() + honk_proof_length, combined_proof.end());
79template <
typename Flavor,
class IO>
84 ipa_transcript->load_proof(ipa_proof);
86 vinfo(
"UltraVerifier: IPA check: ", ipa_verified ?
"true" :
"false");
89 info(
"UltraVerifier: verification failed at IPA check");
100template <
typename Flavor,
class IO>
106 using ClaimBatch = ClaimBatcher::Batch;
108 transcript->load_proof(proof);
111 const size_t log_n = compute_log_n();
117 "Proof size too small. Got " +
std::to_string(proof.size()) +
" field elements, but need at least " +
126 verifier_instance->gate_challenges =
127 transcript->template get_dyadic_powers_of_challenge<FF>(
"Sumcheck:gate_challenge", log_n);
130 VerifierCommitments commitments{ verifier_instance->get_vk(), verifier_instance->witness_commitments };
132 if constexpr (flavor_has_gemini_masking<Flavor>()) {
133 commitments.gemini_masking_poly = verifier_instance->gemini_masking_commitment;
139 std::array<Commitment, NUM_LIBRA_COMMITMENTS> libra_commitments = {};
142 libra_commitments[0] = transcript->template receive_from_prover<Commitment>(
"Libra:concatenation_commitment");
146 sumcheck.
verify(verifier_instance->relation_parameters, verifier_instance->gate_challenges);
149 libra_commitments[1] = transcript->template receive_from_prover<Commitment>(
"Libra:grand_sum_commitment");
150 libra_commitments[2] = transcript->template receive_from_prover<Commitment>(
"Libra:quotient_commitment");
153 ClaimBatcher claim_batcher{
154 .unshifted = ClaimBatch{ commitments.get_unshifted(), sumcheck_output.
claimed_evaluations.get_unshifted() },
155 .shifted = ClaimBatch{ commitments.get_to_be_shifted(), sumcheck_output.
claimed_evaluations.get_shifted() }
159 if constexpr (IsRecursive) {
160 return Commitment::one(
builder);
162 return Commitment::one();
166 auto shplemini_output = Shplemini::compute_batch_opening_claim(claim_batcher,
177 std::move(shplemini_output.batch_opening_claim), transcript, Flavor::FINAL_PCS_MSM_SIZE(log_n));
179 bool consistency_checked =
true;
181 consistency_checked = shplemini_output.consistency_checked;
182 vinfo(
"Ultra Verifier (with ZK): Libra evals consistency checked ", consistency_checked ?
"true" :
"false");
184 vinfo(
"Ultra Verifier sumcheck_verified: ", sumcheck_output.
verified ?
"true" :
"false");
197template <
typename Flavor,
class IO>
205 if constexpr (IO::HasIPA) {
206 std::tie(honk_proof, ipa_proof) = split_rollup_proof(proof);
212 auto [pcs_pairing_points, reduction_succeeded] = reduce_to_pairing_check(honk_proof);
213 vinfo(
"UltraVerifier: reduced to pairing check: ", reduction_succeeded ?
"true" :
"false");
215 if constexpr (!IsRecursive) {
216 if (!reduction_succeeded) {
217 info(
"UltraVerifier: verification failed at reduction step");
224 inputs.reconstruct_from_public(verifier_instance->public_inputs);
228 pi_pairing_points.aggregate(pcs_pairing_points);
233 if constexpr (IsRecursive) {
235 output.points_accumulator =
std::move(pi_pairing_points);
236 if constexpr (IO::HasIPA) {
237 output.ipa_proof = ipa_proof;
241 bool pairing_verified = pi_pairing_points.check();
242 vinfo(
"UltraVerifier: pairing check: ", pairing_verified ?
"true" :
"false");
244 if (!pairing_verified) {
245 info(
"UltraVerifier: verification failed at pairing check");
250 if constexpr (IO::HasIPA) {
251 if (!verify_ipa(ipa_proof,
inputs.ipa_claim)) {
256 output.result =
true;
273#ifdef STARKNET_GARAGA_FLAVORS
#define BB_ASSERT_GTE(left, right,...)
#define BB_BENCH_NAME(name)
static constexpr bool HasZK
static constexpr bool USE_PADDING
static constexpr RepeatedCommitmentsData REPEATED_COMMITMENTS
IPA (inner product argument) commitment scheme class.
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.
Unverified claim (C,r,v) for some witness polynomial p(X) such that.
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...
bool verify_ipa(const Proof &ipa_proof, const IPAClaim &ipa_claim)
Verify IPA proof for rollup circuits (native verifier only)
ReductionResult reduce_to_pairing_check(const Proof &proof)
Reduce ultra proof to verification claims (works for both native and recursive)
typename Transcript::Proof Proof
std::conditional_t< IsRecursive, stdlib::recursion::PairingPoints< Curve >, bb::PairingPoints< Curve > > PairingPoints
size_t compute_log_n() const
Compute log_n based on flavor.
std::conditional_t< IsRecursive, stdlib::recursion::honk::UltraRecursiveVerifierOutput< Builder >, UltraVerifierOutput< Flavor > > Output
typename Flavor::VerifierCommitments VerifierCommitments
typename Flavor::Commitment Commitment
Output verify_proof(const Proof &proof)
Perform ultra verification.
Representation of the Grumpkin Verifier Commitment Key inside a bn254 circuit.
Manages the data that is propagated on the public inputs of an application/function circuit.
The data that is propagated on the public inputs of the inner GoblinAvmRecursiveVerifier circuit.
Manages the data that is propagated on the public inputs of a hiding kernel circuit.
The data that is propagated on the public inputs of a rollup circuit.
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::string to_string(bb::avm2::ValueTag tag)
Logic to support batching opening claims for unshifted and shifted polynomials in Shplemini.
static constexpr size_t LENGTH_WITHOUT_PUB_INPUTS(size_t log_n)
static size_t derive_num_public_inputs(size_t proof_size, size_t log_n)
Derive num_public_inputs from proof size.
Contains the evaluations of multilinear polynomials at the challenge point . These are computed by S...
FF claimed_libra_evaluation
ClaimedEvaluations claimed_evaluations
std::vector< FF > challenge
Result of reducing ultra proof to pairing points check. Contains pairing points and the aggregate res...
PairingPoints pairing_points