31 return static_cast<size_t>(Flavor::VIRTUAL_LOG_N);
34 const size_t log_circuit_size =
static_cast<size_t>(verifier_instance->get_vk()->log_circuit_size);
36 log_circuit_size,
static_cast<size_t>(1),
"VK log_circuit_size is 0, which is invalid for any circuit");
37 return log_circuit_size;
57template <
typename Flavor,
class IO>
60 IO>::split_rollup_proof(
const Proof& combined_proof)
const
66 "Combined rollup proof is too small to contain IPA proof. Expected at least " +
70 const auto honk_proof_length =
static_cast<std::ptrdiff_t>(combined_proof.size() - IPA_PROOF_LENGTH);
72 Proof honk_proof(combined_proof.begin(), combined_proof.begin() + honk_proof_length);
73 Proof ipa_proof(combined_proof.begin() + honk_proof_length, combined_proof.end());
81template <
typename Flavor,
class IO>
86 ipa_transcript->load_proof(ipa_proof);
88 vinfo(
"UltraVerifier: IPA check: ", ipa_verified ?
"true" :
"false");
91 info(
"UltraVerifier: verification failed at IPA check");
102template <
typename Flavor,
class IO>
108 using ClaimBatch = ClaimBatcher::Batch;
110 transcript->load_proof(proof);
113 const size_t log_n = compute_log_n();
119 "Proof size too small. Got " +
std::to_string(proof.size()) +
" field elements, but need at least " +
128 verifier_instance->gate_challenges =
129 transcript->template get_dyadic_powers_of_challenge<FF>(
"Sumcheck:gate_challenge", log_n);
132 verifier_instance->witness_commitments,
133 verifier_instance->gemini_masking_commitment);
138 std::array<Commitment, NUM_SMALL_IPA_COMMITMENTS> libra_commitments = {};
141 libra_commitments[0] = transcript->template receive_from_prover<Commitment>(
"Libra:concatenation_commitment");
145 sumcheck.
verify(verifier_instance->relation_parameters, verifier_instance->gate_challenges);
148 libra_commitments[1] = transcript->template receive_from_prover<Commitment>(
"Libra:grand_sum_commitment");
149 libra_commitments[2] = transcript->template receive_from_prover<Commitment>(
"Libra:quotient_commitment");
152 ClaimBatcher claim_batcher{
153 .unshifted = ClaimBatch{ commitments.get_unshifted(), sumcheck_output.
claimed_evaluations.get_unshifted() },
154 .shifted = ClaimBatch{ commitments.get_to_be_shifted(), sumcheck_output.
claimed_evaluations.get_shifted() }
158 if constexpr (IsRecursive) {
159 return Commitment::one(
builder);
161 return Commitment::one();
165 auto shplemini_output = Shplemini::compute_batch_opening_claim(claim_batcher,
169 Flavor::REPEATED_COMMITMENTS,
175 result.pairing_points = PCS::reduce_verify_batch_opening_claim(
176 std::move(shplemini_output.batch_opening_claim), transcript, Flavor::FINAL_PCS_MSM_SIZE(log_n));
178 bool consistency_checked =
true;
180 consistency_checked = shplemini_output.consistency_checked;
181 vinfo(
"Ultra Verifier (with ZK): Libra evals consistency checked ", consistency_checked ?
"true" :
"false");
183 vinfo(
"Ultra Verifier sumcheck_verified: ", sumcheck_output.
verified ?
"true" :
"false");
184 result.reduction_succeeded = sumcheck_output.
verified && consistency_checked;
196template <
typename Flavor,
class IO>
204 if constexpr (IO::HasIPA) {
205 std::tie(honk_proof, ipa_proof) = split_rollup_proof(proof);
211 auto [pcs_pairing_points, reduction_succeeded] = reduce_to_pairing_check(honk_proof);
212 vinfo(
"UltraVerifier: reduced to pairing check: ", reduction_succeeded ?
"true" :
"false");
214 if constexpr (!IsRecursive) {
215 if (!reduction_succeeded) {
216 info(
"UltraVerifier: verification failed at reduction step");
223 inputs.reconstruct_from_public(verifier_instance->public_inputs);
227 pi_pairing_points.aggregate(pcs_pairing_points);
232 if constexpr (IsRecursive) {
234 output.points_accumulator =
std::move(pi_pairing_points);
235 if constexpr (IO::HasIPA) {
236 output.ipa_proof = ipa_proof;
240 bool pairing_verified = pi_pairing_points.check();
241 vinfo(
"UltraVerifier: pairing check: ", pairing_verified ?
"true" :
"false");
243 if (!pairing_verified) {
244 info(
"UltraVerifier: verification failed at pairing check");
249 if constexpr (IO::HasIPA) {
250 if (!verify_ipa(ipa_proof,
inputs.ipa_claim)) {
255 output.result =
true;
272#ifdef STARKNET_GARAGA_FLAVORS
#define BB_ASSERT_GTE(left, right,...)
#define BB_BENCH_NAME(name)
static constexpr bool HasZK
static constexpr bool USE_PADDING
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::Commitment Commitment
Output verify_proof(const Proof &proof)
Perform ultra verification.
Representation of the Grumpkin Verifier Commitment Key inside a bn254 circuit.
static Commitments construct(const std::shared_ptr< VerificationKey > &verification_key)
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...