35 auto native_vk_hash = native_vk->hash();
42 const std::vector<FF>& challenges)
46 .end_ = points.size(),
52 static_cast<void*
>(coefficients.data()),
static_cast<const void*
>(points.data()),
sizeof(
FF) * points.size());
54 return generic_evaluate_mle<FF>(challenges, coefficients);
58 const HonkProof& proof,
const std::vector<std::vector<fr>>& public_inputs_vec_nt)
63 public_inputs_ct.reserve(public_inputs_vec_nt.size());
65 for (
const auto& vec : public_inputs_vec_nt) {
66 std::vector<FF> vec_ct;
67 vec_ct.reserve(vec.size());
68 for (
const auto& el : vec) {
71 public_inputs_ct.push_back(vec_ct);
87 using ClaimBatch = ClaimBatcher::Batch;
90 throw_or_abort(
"AvmRecursiveVerifier::verify_proof: public inputs size mismatch");
92 for (
const auto& public_input : public_inputs) {
94 throw_or_abort(
"AvmRecursiveVerifier::verify_proof: public input size mismatch");
102 info(
"AVM vk hash in recursive verifier: ",
vk_hash.get_value());
104 RelationParams relation_parameters;
109 for (
size_t j = 0; j < public_inputs[i].size(); j++) {
111 public_inputs[i][j]);
115 for (
auto [comm, label] :
zip_view(commitments.get_wires(), commitments.get_wires_labels())) {
116 comm =
transcript->template receive_from_prover<Commitment>(label);
120 relation_parameters.beta = beta;
121 relation_parameters.gamma = gamma;
124 for (
auto [label, commitment] :
zip_view(commitments.get_derived_labels(), commitments.get_derived())) {
125 commitment =
transcript->template receive_from_prover<Commitment>(label);
129 one.convert_constant_to_fixed_witness(&
builder);
131 std::vector<FF> padding_indicator_array(
key->log_fixed_circuit_size);
132 std::ranges::fill(padding_indicator_array, one);
135 const FF alpha =
transcript->template get_challenge<FF>(
"Sumcheck:alpha");
137 SumcheckVerifier<Flavor> sumcheck(
transcript, alpha,
key->log_fixed_circuit_size);
139 std::vector<FF> gate_challenges =
140 transcript->template get_dyadic_powers_of_challenge<FF>(
"Sumcheck:gate_challenge",
key->log_fixed_circuit_size);
144 SumcheckOutput<Flavor> output = sumcheck.verify(relation_parameters, gate_challenges, padding_indicator_array);
145 vinfo(
"verified sumcheck: ", (output.verified));
149 output.claimed_evaluations.get(C::public_inputs_cols_0_),
150 output.claimed_evaluations.get(C::public_inputs_cols_1_),
151 output.claimed_evaluations.get(C::public_inputs_cols_2_),
152 output.claimed_evaluations.get(C::public_inputs_cols_3_),
158 public_input_evaluation.assert_equal(claimed_evaluations[i],
159 format(
"public_input_evaluation failed at column ", i));
163 auto unshifted_comms = commitments.get_unshifted();
164 auto unshifted_evals = output.claimed_evaluations.get_unshifted();
165 auto shifted_comms = commitments.get_to_be_shifted();
166 auto shifted_evals = output.claimed_evaluations.get_shifted();
170 std::vector<std::string> unshifted_batching_challenge_labels;
171 unshifted_batching_challenge_labels.reserve(unshifted_comms.size() - 1);
172 for (
size_t idx = 0; idx < unshifted_comms.size() - 1; idx++) {
173 unshifted_batching_challenge_labels.push_back(
"rho_" +
std::to_string(idx));
175 std::vector<std::string> shifted_batching_challenge_labels;
176 shifted_batching_challenge_labels.reserve(shifted_comms.size());
177 for (
size_t idx = 0; idx < shifted_comms.size(); idx++) {
178 shifted_batching_challenge_labels.push_back(
"rho_" +
std::to_string(unshifted_comms.size() - 1 + idx));
182 auto unshifted_challenges =
transcript->template get_challenges<FF>(unshifted_batching_challenge_labels);
183 auto shifted_challenges =
transcript->template get_challenges<FF>(shifted_batching_challenge_labels);
188 Commitment::batch_mul(
189 std::vector<Commitment>(unshifted_comms.begin() + 1, unshifted_comms.end()), unshifted_challenges, 128);
191 Commitment squashed_shifted = Commitment::batch_mul(
192 std::vector<Commitment>(shifted_comms.begin(), shifted_comms.end()), shifted_challenges, 128);
196 unshifted_challenges.begin(), unshifted_challenges.end(), unshifted_evals.begin() + 1, unshifted_evals[0]);
198 FF squashed_shifted_eval =
199 std::inner_product(shifted_challenges.begin(), shifted_challenges.end(), shifted_evals.begin(),
FF(0));
202 ClaimBatcher squashed_claim_batcher{ .unshifted = ClaimBatch{ .commitments =
RefVector(squashed_unshifted),
203 .evaluations =
RefVector(squashed_unshifted_eval) },
204 .shifted = ClaimBatch{ .commitments =
RefVector(squashed_shifted),
205 .evaluations =
RefVector(squashed_shifted_eval) } };
207 Shplemini::compute_batch_opening_claim(
208 padding_indicator_array, squashed_claim_batcher, output.challenge, Commitment::one(&
builder),
transcript)
209 .batch_opening_claim;
214 info(
"AVM Recursive verifier builder failed with error: ",
builder.err());
217 return pairing_points;
#define AVM_NUM_PUBLIC_INPUT_COLUMNS
#define AVM_PUBLIC_INPUTS_COLUMNS_MAX_LENGTH
IPA (inner product argument) commitment scheme class.
NativeFlavor::VerifierCommitments_< Commitment, VerificationKey > VerifierCommitments
AvmRecursiveFlavorSettings::Curve Curve
AvmRecursiveFlavorSettings::PCS PCS
std::shared_ptr< Transcript > transcript
typename Flavor::VerifierCommitments VerifierCommitments
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
AvmRecursiveVerifier(Builder &builder)
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
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)