29 , transcript(transcript)
36 auto native_vk_hash = native_vk->hash();
43 const std::vector<FF>& challenges)
47 .end_ = points.size(),
53 static_cast<void*
>(coefficients.data()),
static_cast<const void*
>(points.data()),
sizeof(
FF) * points.size());
55 return generic_evaluate_mle<FF>(challenges, coefficients);
59 const HonkProof& proof,
const std::vector<std::vector<fr>>& public_inputs_vec_nt)
64 public_inputs_ct.reserve(public_inputs_vec_nt.size());
66 for (
const auto& vec : public_inputs_vec_nt) {
67 std::vector<FF> vec_ct;
68 vec_ct.reserve(vec.size());
69 for (
const auto& el : vec) {
72 public_inputs_ct.push_back(vec_ct);
88 using ClaimBatch = ClaimBatcher::Batch;
91 throw_or_abort(
"AvmRecursiveVerifier::verify_proof: public inputs size mismatch");
93 for (
const auto& public_input : public_inputs) {
95 throw_or_abort(
"AvmRecursiveVerifier::verify_proof: public input size mismatch");
103 info(
"AVM vk hash in recursive verifier: ",
vk_hash.get_value());
105 RelationParams relation_parameters;
110 for (
size_t j = 0; j < public_inputs[i].size(); j++) {
112 public_inputs[i][j]);
116 for (
auto [comm, label] :
zip_view(commitments.get_wires(), commitments.get_wires_labels())) {
117 comm =
transcript->template receive_from_prover<Commitment>(label);
121 relation_parameters.beta = beta;
122 relation_parameters.gamma = gamma;
125 for (
auto [label, commitment] :
zip_view(commitments.get_derived_labels(), commitments.get_derived())) {
126 commitment =
transcript->template receive_from_prover<Commitment>(label);
132 const FF alpha =
transcript->template get_challenge<FF>(
"Sumcheck:alpha");
136 std::vector<FF> gate_challenges =
141 SumcheckOutput<Flavor> output = sumcheck.verify(relation_parameters, gate_challenges, padding_indicator_array);
142 vinfo(
"verified sumcheck: ", (output.verified));
146 output.claimed_evaluations.get(C::public_inputs_cols_0_),
147 output.claimed_evaluations.get(C::public_inputs_cols_1_),
148 output.claimed_evaluations.get(C::public_inputs_cols_2_),
149 output.claimed_evaluations.get(C::public_inputs_cols_3_),
155 public_input_evaluation.assert_equal(claimed_evaluations[i],
156 format(
"public_input_evaluation failed at column ", i));
160 auto unshifted_comms = commitments.get_unshifted();
161 auto unshifted_evals = output.claimed_evaluations.get_unshifted();
162 auto shifted_comms = commitments.get_to_be_shifted();
163 auto shifted_evals = output.claimed_evaluations.get_shifted();
167 std::vector<std::string> unshifted_batching_challenge_labels;
168 unshifted_batching_challenge_labels.reserve(unshifted_comms.size() - 1);
169 for (
size_t idx = 0; idx < unshifted_comms.size() - 1; idx++) {
170 unshifted_batching_challenge_labels.push_back(
"rho_" +
std::to_string(idx));
172 std::vector<std::string> shifted_batching_challenge_labels;
173 shifted_batching_challenge_labels.reserve(shifted_comms.size());
174 for (
size_t idx = 0; idx < shifted_comms.size(); idx++) {
175 shifted_batching_challenge_labels.push_back(
"rho_" +
std::to_string(unshifted_comms.size() - 1 + idx));
179 auto unshifted_challenges =
transcript->template get_challenges<FF>(unshifted_batching_challenge_labels);
180 auto shifted_challenges =
transcript->template get_challenges<FF>(shifted_batching_challenge_labels);
185 Commitment::batch_mul(
186 std::vector<Commitment>(unshifted_comms.begin() + 1, unshifted_comms.end()), unshifted_challenges, 128);
188 Commitment squashed_shifted = Commitment::batch_mul(
189 std::vector<Commitment>(shifted_comms.begin(), shifted_comms.end()), shifted_challenges, 128);
193 unshifted_challenges.begin(), unshifted_challenges.end(), unshifted_evals.begin() + 1, unshifted_evals[0]);
195 FF squashed_shifted_eval =
196 std::inner_product(shifted_challenges.begin(), shifted_challenges.end(), shifted_evals.begin(),
FF(0));
199 ClaimBatcher squashed_claim_batcher{ .unshifted = ClaimBatch{ .commitments =
RefVector(squashed_unshifted),
200 .evaluations =
RefVector(squashed_unshifted_eval) },
201 .shifted = ClaimBatch{ .commitments =
RefVector(squashed_shifted),
202 .evaluations =
RefVector(squashed_shifted_eval) } };
204 Shplemini::compute_batch_opening_claim(
205 padding_indicator_array, squashed_claim_batcher, output.challenge, Commitment::one(&
builder),
transcript)
206 .batch_opening_claim;
211 info(
"AVM Recursive verifier builder failed with error: ",
builder.err());
216 return pairing_points;
#define BB_ASSERT(expression,...)
#define AVM_NUM_PUBLIC_INPUT_COLUMNS
#define AVM_PUBLIC_INPUTS_COLUMNS_MAX_LENGTH
IPA (inner product argument) commitment scheme class.
static stdlib::field_t< Builder > hash_avm_transcript(Builder &builder, const stdlib::Proof< Builder > &stdlib_proof, const std::vector< std::vector< stdlib::field_t< Builder > > > &public_inputs)
Construct a transcript replicating the operations performed on the AVM transcript during proof verifi...
NativeFlavor::VerifierCommitments_< Commitment, VerificationKey > VerifierCommitments
AvmRecursiveFlavorSettings::Curve Curve
AvmRecursiveFlavorSettings::PCS PCS
AvmRecursiveVerifier(Builder &builder, const std::shared_ptr< Transcript > &transcript=std::make_shared< Transcript >())
std::shared_ptr< Transcript > transcript
typename Flavor::VerifierCommitments VerifierCommitments
FF hash_avm_transcript(const StdlibProof &stdlib_proof)
Hash the transcript after verification is complete to produce a hash of the public inputs and proofs ...
std::shared_ptr< VerificationKey > key
stdlib::recursion::PairingPoints< Curve > PairingPoints
FF evaluate_public_input_column(const std::vector< FF > &points, const std::vector< FF > &challenges)
PairingPoints verify_proof(const HonkProof &proof, const std::vector< std::vector< fr > > &public_inputs_vec_nt)
typename Flavor::CircuitBuilder Builder
bool is_verification_complete
typename Flavor::Commitment Commitment
static constexpr std::array< Commitment, VerificationKey::NUM_PRECOMPUTED_COMMITMENTS > get_all()
A simple wrapper around a vector of stdlib field elements representing a proof.
std::string format(Args... args)
constexpr std::size_t MAX_AVM_TRACE_SIZE
constexpr std::size_t MAX_AVM_TRACE_LOG_SIZE
std::vector< fr > HonkProof
RefVector(T &, Ts &...) -> RefVector< T >
Deduction guide for the RefVector class. Allows for RefVector {a, b, c} without explicit template par...
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::string to_string(bb::avm2::ValueTag tag)
For a small integer N = virtual_log_n and a given witness x = log_n, compute in-circuit an indicator_...
static BackingMemory allocate(size_t size)
A shared pointer array template that represents a virtual array filled with zeros up to virtual_size_...
size_t start_
The starting index of the memory-backed range.
Logic to support batching opening claims for unshifted, shifted and interleaved polynomials in Shplem...
Container for parameters used by the grand product (permutation, lookup) Honk relations.
An object storing two EC points that represent the inputs to a pairing check.
void throw_or_abort(std::string const &err)