24template <
typename Flavor>
25void put_translation_data_in_relation_parameters_impl(RelationParameters<typename Flavor::FF>& relation_parameters,
27 const typename Flavor::BF& batching_challenge_v,
29 requires(!Flavor::Curve::is_stdlib_type)
34 const auto compute_four_limbs = [](
const auto& in) {
35 constexpr size_t NUM_LIMB_BITS = Flavor::NUM_LIMB_BITS;
36 return std::array<FF, 4>{ in.slice(0, NUM_LIMB_BITS),
37 in.slice(NUM_LIMB_BITS, NUM_LIMB_BITS * 2),
38 in.slice(NUM_LIMB_BITS * 2, NUM_LIMB_BITS * 3),
39 in.slice(NUM_LIMB_BITS * 3, NUM_LIMB_BITS * 4) };
42 const auto compute_five_limbs = [](
const auto& in) {
43 constexpr size_t NUM_LIMB_BITS = Flavor::NUM_LIMB_BITS;
45 in.slice(NUM_LIMB_BITS, NUM_LIMB_BITS * 2),
46 in.slice(NUM_LIMB_BITS * 2, NUM_LIMB_BITS * 3),
47 in.slice(NUM_LIMB_BITS * 3, NUM_LIMB_BITS * 4),
51 relation_parameters.evaluation_input_x = compute_five_limbs(evaluation_input_x);
53 uint256_t batching_challenge_v_power{ batching_challenge_v };
54 for (
size_t i = 0; i < 4; i++) {
55 relation_parameters.batching_challenge_v[i] = compute_five_limbs(batching_challenge_v_power);
56 batching_challenge_v_power = BF(batching_challenge_v_power) * batching_challenge_v;
59 relation_parameters.accumulated_result = compute_four_limbs(accumulated_result);
63template <
typename Flavor>
64void put_translation_data_in_relation_parameters_impl(RelationParameters<typename Flavor::FF>& relation_parameters,
66 const typename Flavor::BF& batching_challenge_v,
68 requires(Flavor::Curve::is_stdlib_type)
73 const auto compute_four_limbs = [](
const BF& in) {
74 auto result = std::array<FF, 4>{
FF(in.get_limb(0).element),
75 FF(in.get_limb(1).element),
76 FF(in.get_limb(2).element),
77 FF(in.get_limb(3).element) };
79 for (
const auto& limb :
result) {
85 const auto compute_five_limbs = [](
const BF& in) {
87 FF(in.get_limb(1).element),
88 FF(in.get_limb(2).element),
89 FF(in.get_limb(3).element),
90 FF(in.get_prime_basis_limb()) };
92 for (
const auto& limb :
result) {
98 relation_parameters.evaluation_input_x = compute_five_limbs(evaluation_input_x);
100 BF batching_challenge_v_power = batching_challenge_v;
101 for (
size_t i = 0; i < 4; i++) {
102 relation_parameters.batching_challenge_v[i] = compute_five_limbs(batching_challenge_v_power);
103 batching_challenge_v_power = batching_challenge_v_power * batching_challenge_v;
106 relation_parameters.accumulated_result = compute_four_limbs(accumulated_result);
118 for (
auto& limb : relation_parameters.accumulated_result) {
119 limb.clear_round_provenance();
126 put_translation_data_in_relation_parameters_impl<Flavor>(
127 relation_parameters, evaluation_input_x, batching_challenge_v, accumulated_result);
142template <
typename Flavor>
145 transcript->load_proof(proof);
148 transcript->add_to_hash_buffer(
"vk_hash", vk_hash);
149 vinfo(
"Translator vk hash in verifier: ", vk_hash);
156 if constexpr (IsRecursive) {
157 mark_witness_as_used(accumulated_result.get_prime_basis_limb());
161 put_translation_data_in_relation_parameters();
164 commitments.gemini_masking_poly = transcript->template receive_from_prover<Commitment>(
"Gemini:masking_poly_comm");
167 commitments.op = op_queue_wire_commitments[0];
168 commitments.x_lo_y_hi = op_queue_wire_commitments[1];
169 commitments.x_hi_z_1 = op_queue_wire_commitments[2];
170 commitments.y_lo_z_2 = op_queue_wire_commitments[3];
173 for (
auto [comm,
label] :
zip_view(commitments.get_non_opqueue_wires_and_ordered_range_constraints(),
174 commitment_labels.get_non_opqueue_wires_and_ordered_range_constraints())) {
175 comm = transcript->template receive_from_prover<Commitment>(
label);
179 FF beta = transcript->template get_challenge<FF>(
"beta");
180 FF gamma = transcript->template get_challenge<FF>(
"gamma");
182 relation_parameters.beta = beta;
183 relation_parameters.gamma = gamma;
186 commitments.z_perm = transcript->template receive_from_prover<Commitment>(commitment_labels.z_perm);
191template <
typename Flavor>
195 using PCS =
typename Flavor::PCS;
198 using ClaimBatch =
typename ClaimBatcher::Batch;
201 auto commitments = receive_pre_sumcheck();
205 const FF alpha = transcript->template get_challenge<FF>(
"Sumcheck:alpha");
210 std::vector<FF> gate_challenges = transcript->template get_dyadic_powers_of_challenge<FF>(
214 std::array<Commitment, NUM_SMALL_IPA_COMMITMENTS> libra_commitments = {};
215 libra_commitments[0] = transcript->template receive_from_prover<Commitment>(
"Libra:concatenation_commitment");
217 auto sumcheck_output = sumcheck.verify(relation_parameters, gate_challenges);
219 libra_commitments[1] = transcript->template receive_from_prover<Commitment>(
"Libra:grand_sum_commitment");
220 libra_commitments[2] = transcript->template receive_from_prover<Commitment>(
"Libra:quotient_commitment");
224 auto& claimed = sumcheck_output.claimed_evaluations;
226 claimed.get_groups_to_be_concatenated_shifted(),
std::span<const FF>(sumcheck_output.challenge));
229 auto combined_unshifted_comms = commitments.get_pcs_unshifted();
230 auto combined_unshifted_evals = claimed.get_pcs_unshifted();
234 auto combined_shifted_comms = commitments.get_pcs_to_be_shifted();
235 RefVector<FF> combined_shifted_evals(claimed.get_pcs_shifted());
236 for (
auto& eval : concat_shift_evals) {
244 throw_or_abort(
"Translator verifier: PCS commitment/evaluation size mismatch");
247 ClaimBatcher claim_batcher{ .unshifted = ClaimBatch{ combined_unshifted_comms, combined_unshifted_evals },
248 .shifted = ClaimBatch{ combined_shifted_comms, combined_shifted_evals } };
251 if constexpr (IsRecursive) {
252 commitment_one = Commitment::one(
builder);
254 commitment_one = Commitment::one();
257 auto [opening_claim, consistency_checked] =
258 Shplemini::compute_batch_opening_claim(claim_batcher,
259 sumcheck_output.challenge,
262 Flavor::REPEATED_COMMITMENTS,
264 sumcheck_output.claimed_libra_evaluation);
266 auto pairing_points = PCS::reduce_verify_batch_opening_claim(
std::move(opening_claim), transcript);
268 vinfo(
"Translator Verifier: sumcheck verified: ", sumcheck_output.verified);
269 vinfo(
"Translator Verifier: consistency checked: ", consistency_checked);
271 return { pairing_points, sumcheck_output.verified && consistency_checked };
#define BB_ASSERT(expression,...)
bb::field< bb::Bn254FrParams > FF
#define BB_BENCH_NAME(name)
typename Curve::ScalarField FF
typename Curve::BaseField BF
IPA (inner product argument) commitment scheme class.
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 for statements of the form for multilinear polynomials .
static constexpr size_t NUM_PCS_UNSHIFTED
static constexpr size_t CONST_TRANSLATOR_LOG_N
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...
static constexpr size_t NUM_PCS_TO_BE_SHIFTED
Translator verifier class that verifies the proof of the Translator circuit.
ReductionResult reduce_to_pairing_check()
Reduce the translator proof to a pairing check.
void put_translation_data_in_relation_parameters()
Populate relation parameters with translation data from ECCVM verifier.
typename Flavor::VerifierCommitments VerifierCommitments
VerifierCommitments receive_pre_sumcheck()
Load translator proof and run the pre-sumcheck (Oink-like) phase on the shared transcript.
typename Flavor::CommitmentLabels CommitmentLabels
typename Flavor::Commitment Commitment
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
This file contains part of the logic for the Origin Tag mechanism that tracks the use of in-circuit p...
Logic to support batching opening claims for unshifted and shifted polynomials in Shplemini.
Result of reducing translator proof to pairing check.
void throw_or_abort(std::string const &err)