20template <
typename Curve>
22 std::shared_ptr<MegaZKVKAndHash> mega_zk_vk_and_hash, std::shared_ptr<Transcript> transcript)
23 : mega_zk_vk_and_hash(
std::move(mega_zk_vk_and_hash))
24 , transcript(
std::move(transcript))
33template <
typename Curve>
35 const Proof& mega_zk_proof)
37 transcript->load_proof(mega_zk_proof);
39 if constexpr (IsRecursive) {
40 builder = mega_zk_proof.back().get_context();
47 throw_or_abort(
"MegaZK Oink proof too short to derive num_public_inputs");
52 oink_verifier.
verify(
false);
54 mega_zk_relation_parameters = mega_zk_verifier_instance->relation_parameters;
58 .kernel_calldata_commitment = mega_zk_verifier_instance->witness_commitments.kernel_calldata,
59 .ecc_op_wires = mega_zk_verifier_instance->witness_commitments.get_ecc_op_wires().get_copy(),
69template <
typename Curve>
72 const TransBF& evaluation_input_x,
73 const TransBF& batching_challenge_v,
74 const TransBF& accumulated_result,
75 const std::array<Commitment, TranslatorFlavor::NUM_OP_QUEUE_WIRES>&
76 op_queue_wire_commitments)
87 op_queue_wire_commitments);
90 return trans_commitments;
105 const FF alpha = transcript->template get_challenge<FF>(
"Sumcheck:alpha");
108 FF alpha_power_KH =
FF(1);
109 for (
size_t i = 0; i < MegaZKFlavorT::NUM_SUBRELATIONS; i++) {
110 alpha_power_KH *= alpha;
118 std::vector<FF> gate_challenges =
119 transcript->template get_dyadic_powers_of_challenge<FF>(
"Sumcheck:gate_challenge", JOINT_LOG_N);
122 libra_commitments = {};
123 libra_commitments[0] = transcript->template receive_from_prover<Commitment>(
"Libra:concatenation_commitment");
126 FF libra_total_sum = transcript->template receive_from_prover<FF>(
"Libra:Sum");
127 libra_challenge = transcript->template get_challenge<FF>(
"Libra:Challenge");
130 static constexpr bool UseCommittedSumcheck =
true;
135 joint_challenge.clear();
136 joint_challenge.reserve(JOINT_LOG_N);
138 for (
size_t round_idx = 0; round_idx < JOINT_LOG_N; round_idx++) {
139 joint_round.
process_round(transcript, joint_challenge, gate_sep, round_idx);
142 TransFlavor::set_minicircuit_evaluations(
145 "Sumcheck:minicircuit_evaluations"));
151 auto transcript_evals =
152 transcript->template receive_from_prover<std::array<FF, MegaZKFlavorT::NUM_ALL_ENTITIES>>(
153 "Sumcheck:evaluations");
154 for (
auto [eval, te] :
zip_view(mega_zk_evals.get_all(), transcript_evals)) {
161 auto get_full_circuit_evals =
162 transcript->template receive_from_prover<std::array<FF, TransFlavor::NUM_FULL_CIRCUIT_EVALUATIONS>>(
163 "Sumcheck:evaluations_translator");
164 TransFlavor::complete_full_circuit_evaluations(
169 if constexpr (IsRecursive) {
170 const auto challenge_tag = joint_challenge.back().get_origin_tag();
171 for (
auto& eval : mega_zk_evals.get_all()) {
172 eval.set_origin_tag(challenge_tag);
174 for (
auto& eval : trans_evals.get_all()) {
175 eval.set_origin_tag(challenge_tag);
188 mega_zk_evals, mega_zk_relation_parameters, final_gate_sep, mega_zk_alphas);
197 trans_evals, translator_relation_parameters, final_gate_sep, translator_alphas);
200 FF frv_joint = frv_mega_zk + alpha_power_KH * frv_translator;
203 libra_evaluation = transcript->template receive_from_prover<FF>(
"Libra:claimed_evaluation");
206 libra_commitments[1] = transcript->template receive_from_prover<Commitment>(
"Libra:grand_sum_commitment");
207 libra_commitments[2] = transcript->template receive_from_prover<Commitment>(
"Libra:quotient_commitment");
209 if constexpr (IsRecursive) {
210 const auto challenge_tag = joint_challenge.back().get_origin_tag();
211 libra_evaluation.set_origin_tag(challenge_tag);
214 frv_joint += libra_evaluation * libra_challenge;
218 round_univariate_commitments =
std::move(joint_round.round_univariate_commitments);
219 round_univariate_evaluations =
std::move(joint_round.round_univariate_evaluations);
229template <
typename Curve>
235 using ClaimBatch =
typename ClaimBatcher::Batch;
238 if constexpr (IsRecursive) {
239 return Commitment::one(
builder);
241 return Commitment::one();
247 trans_evals.get_groups_to_be_concatenated_shifted(),
std::span<const FF>(joint_challenge));
250 RefVector<FF> joint_unshifted_evals = trans_evals.get_pcs_unshifted();
253 for (
auto& comm : mega_zk_commitments.get_unshifted()) {
256 for (
auto& eval : mega_zk_evals.get_unshifted()) {
262 RefVector<FF> joint_shifted_evals = mega_zk_evals.get_shifted();
264 auto trans_shifted_comms = trans_commitments.get_pcs_to_be_shifted();
265 auto trans_pcs_shifted_evals = trans_evals.get_pcs_shifted();
266 for (
auto& comm : trans_shifted_comms) {
269 for (
auto& eval : trans_pcs_shifted_evals) {
272 for (
auto& eval : concat_shift_evals) {
276 ClaimBatcher joint_claim_batcher{ .unshifted = ClaimBatch{ joint_unshifted_comms, joint_unshifted_evals },
277 .shifted = ClaimBatch{ joint_shifted_comms, joint_shifted_evals } };
279 auto [opening_claim, consistency_checked] =
280 MegaZKShplemini::compute_batch_opening_claim(joint_claim_batcher,
284 REPEATED_COMMITMENTS,
287 round_univariate_commitments,
288 round_univariate_evaluations);
290 auto pairing_points = MegaZKFlavorT::PCS::reduce_verify_batch_opening_claim(
std::move(opening_claim), transcript);
292 return { pairing_points, sumcheck_verified && consistency_checked };
295template <
typename Curve>
297 const Proof& joint_proof,
298 const TransBF& evaluation_input_x,
299 const TransBF& batching_challenge_v,
300 const TransBF& accumulated_result,
301 const std::array<Commitment, TranslatorFlavor::NUM_OP_QUEUE_WIRES>& op_queue_wire_commitments)
305 mega_zk_verifier_instance->witness_commitments };
306 auto trans_commitments = verify_translator_oink(
307 joint_proof, evaluation_input_x, batching_challenge_v, accumulated_result, op_queue_wire_commitments);
308 bool sumcheck_verified = verify_joint_sumcheck();
309 return verify_joint_pcs(sumcheck_verified, mega_zk_commitments, trans_commitments);
bb::field< bb::Bn254FrParams > FF
Verifier for the batched MegaZK circuit + translator sumcheck and PCS.
std::conditional_t< IsRecursive, stdlib::Proof< UltraCircuitBuilder >, HonkProof > Proof
BatchedHonkTranslatorVerifier_(std::shared_ptr< MegaZKVKAndHash > mega_zk_vk_and_hash, std::shared_ptr< Transcript > transcript)
Construct the batched verifier with minimal state.
typename TransFlavor::VerifierCommitments TransVerifierCommitments
ReductionResult verify_joint_pcs(bool sumcheck_verified, MegaZKVerifierCommitments &mega_zk_commitments, TransVerifierCommitments &trans_commitments)
Execute the joint Shplemini / KZG PCS reduction.
typename MegaZKFlavorT::Commitment Commitment
ReductionResult verify(const Proof &joint_proof, const TransBF &evaluation_input_x, const TransBF &batching_challenge_v, const TransBF &accumulated_result, const std::array< Commitment, TranslatorFlavor::NUM_OP_QUEUE_WIRES > &op_queue_wire_commitments)
Phase 2: Verify translator Oink + joint sumcheck + joint PCS.
bool verify_joint_sumcheck()
Verify the joint 17-round sumcheck.
typename MegaZKFlavorT::FF FF
typename TransFlavor::BF TransBF
OinkResult verify_mega_zk_oink(const Proof &mega_zk_proof)
Phase 1: Verify the MegaZK Oink phase on the shared transcript.
typename MegaZKFlavorT::VerifierCommitments MegaZKVerifierCommitments
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.
A template class for a reference vector. Behaves as if std::vector<T&> was possible.
void push_back(T &element)
Implementation of the Sumcheck Verifier Round.
FF compute_full_relation_purported_value(const ClaimedEvaluations &purported_evaluations, const bb::RelationParameters< FF > &relation_parameters, const bb::GateSeparatorPolynomial< FF > &gate_separators, const SubrelationSeparators &alphas)
Compute the full relation purported value.
void process_round(const std::shared_ptr< Transcript > &transcript, std::vector< FF > &multivariate_challenge, bb::GateSeparatorPolynomial< FF > &gate_separators, size_t round_idx)
Process a single sumcheck round: receive univariate from transcript, verify sum, generate challenge.
bool perform_final_verification(const FF &full_honk_purported_value)
Perform final verification: check that the computed target sum matches the full relation evaluation....
static constexpr size_t CONST_TRANSLATOR_LOG_N
static constexpr size_t LOG_MINI_CIRCUIT_SIZE
static std::array< FFType, NUM_CONCATENATED_POLYS > reconstruct_concatenated_evaluations(const std::vector< RefVector< FFType > > &groups, std::span< const FFType > challenge)
Reconstruct concatenated polynomial evaluations from individual wire evaluations using the Lagrange b...
Translator verifier class that verifies the proof of the Translator circuit.
RelationParams relation_parameters
VerifierCommitments receive_pre_sumcheck()
Load translator proof and run the pre-sumcheck (Oink-like) phase on the shared transcript.
Entry point for Barretenberg command-line interface.
std::array< FF, N > initialize_relation_separator(const FF &alpha)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Result of Phase 1 (MegaZK Oink verification).
std::vector< FF > public_inputs
Result of the batched sumcheck/PCS reduction.
Logic to support batching opening claims for unshifted and shifted polynomials in Shplemini.
Implementation of the methods for the -polynomials used in in Sumcheck.
Computes Oink proof length from flavor traits.
static FF evaluate_at_challenge(std::span< const FF > multivariate_challenge, const size_t log_circuit_size)
Compute the evaluation of at the sumcheck challenge.
void throw_or_abort(std::string const &err)