23template <
typename Flavor>
24void put_translation_data_in_relation_parameters_impl(RelationParameters<typename Flavor::FF>& relation_parameters,
26 const typename Flavor::BF& batching_challenge_v,
28 requires(!Flavor::Curve::is_stdlib_type)
33 const auto compute_four_limbs = [](
const auto& in) {
34 constexpr size_t NUM_LIMB_BITS = Flavor::NUM_LIMB_BITS;
35 return std::array<FF, 4>{ in.slice(0, NUM_LIMB_BITS),
36 in.slice(NUM_LIMB_BITS, NUM_LIMB_BITS * 2),
37 in.slice(NUM_LIMB_BITS * 2, NUM_LIMB_BITS * 3),
38 in.slice(NUM_LIMB_BITS * 3, NUM_LIMB_BITS * 4) };
41 const auto compute_five_limbs = [](
const auto& in) {
42 constexpr size_t NUM_LIMB_BITS = Flavor::NUM_LIMB_BITS;
44 in.slice(NUM_LIMB_BITS, NUM_LIMB_BITS * 2),
45 in.slice(NUM_LIMB_BITS * 2, NUM_LIMB_BITS * 3),
46 in.slice(NUM_LIMB_BITS * 3, NUM_LIMB_BITS * 4),
50 relation_parameters.evaluation_input_x = compute_five_limbs(evaluation_input_x);
52 uint256_t batching_challenge_v_power{ batching_challenge_v };
53 for (
size_t i = 0; i < 4; i++) {
54 relation_parameters.batching_challenge_v[i] = compute_five_limbs(batching_challenge_v_power);
55 batching_challenge_v_power = BF(batching_challenge_v_power) * batching_challenge_v;
58 relation_parameters.accumulated_result = compute_four_limbs(accumulated_result);
62template <
typename Flavor>
63void put_translation_data_in_relation_parameters_impl(RelationParameters<typename Flavor::FF>& relation_parameters,
65 const typename Flavor::BF& batching_challenge_v,
67 requires(Flavor::Curve::is_stdlib_type)
72 const auto compute_four_limbs = [](
const BF& in) {
73 auto result = std::array<FF, 4>{
FF(in.binary_basis_limbs[0].element),
74 FF(in.binary_basis_limbs[1].element),
75 FF(in.binary_basis_limbs[2].element),
76 FF(in.binary_basis_limbs[3].element) };
78 for (
const auto& limb : result) {
84 const auto compute_five_limbs = [](
const BF& in) {
86 FF(in.binary_basis_limbs[1].element),
87 FF(in.binary_basis_limbs[2].element),
88 FF(in.binary_basis_limbs[3].element),
89 FF(in.prime_basis_limb) };
91 for (
const auto& limb : result) {
97 relation_parameters.evaluation_input_x = compute_five_limbs(evaluation_input_x);
99 BF batching_challenge_v_power = batching_challenge_v;
100 for (
size_t i = 0; i < 4; i++) {
101 relation_parameters.batching_challenge_v[i] = compute_five_limbs(batching_challenge_v_power);
102 batching_challenge_v_power = batching_challenge_v_power * batching_challenge_v;
105 relation_parameters.accumulated_result = compute_four_limbs(accumulated_result);
117 for (
auto& limb : relation_parameters.accumulated_result) {
118 limb.clear_round_provenance();
125 put_translation_data_in_relation_parameters_impl<Flavor>(
126 relation_parameters, evaluation_input_x, batching_challenge_v, accumulated_result);
141template <
typename Flavor>
144 transcript->load_proof(proof);
147 transcript->add_to_hash_buffer(
"vk_hash", vk_hash);
148 vinfo(
"Translator vk hash in verifier: ", vk_hash);
155 if constexpr (IsRecursive) {
156 mark_witness_as_used(accumulated_result.prime_basis_limb);
160 put_translation_data_in_relation_parameters();
163 commitments.gemini_masking_poly = transcript->template receive_from_prover<Commitment>(
"Gemini:masking_poly_comm");
166 commitments.op = op_queue_wire_commitments[0];
167 commitments.x_lo_y_hi = op_queue_wire_commitments[1];
168 commitments.x_hi_z_1 = op_queue_wire_commitments[2];
169 commitments.y_lo_z_2 = op_queue_wire_commitments[3];
172 for (
auto [comm, label] :
zip_view(commitments.get_non_opqueue_wires_and_ordered_range_constraints(),
173 commitment_labels.get_non_opqueue_wires_and_ordered_range_constraints())) {
174 comm = transcript->template receive_from_prover<Commitment>(label);
178 FF beta = transcript->template get_challenge<FF>(
"beta");
179 FF gamma = transcript->template get_challenge<FF>(
"gamma");
181 relation_parameters.beta = beta;
182 relation_parameters.gamma = gamma;
185 commitments.z_perm = transcript->template receive_from_prover<Commitment>(commitment_labels.z_perm);
190template <
typename Flavor>
194 using PCS =
typename Flavor::PCS;
197 using ClaimBatch =
typename ClaimBatcher::Batch;
200 auto commitments = receive_pre_sumcheck();
204 const FF alpha = transcript->template get_challenge<FF>(
"Sumcheck:alpha");
210 for (
size_t idx = 0; idx < gate_challenges.size(); idx++) {
211 gate_challenges[idx] = transcript->template get_challenge<FF>(
"Sumcheck:gate_challenge_" +
std::to_string(idx));
215 std::array<Commitment, NUM_LIBRA_COMMITMENTS> libra_commitments = {};
216 libra_commitments[0] = transcript->template receive_from_prover<Commitment>(
"Libra:concatenation_commitment");
221 auto sumcheck_output = sumcheck.verify(relation_parameters, gate_challenges, padding_indicator_array);
223 libra_commitments[1] = transcript->template receive_from_prover<Commitment>(
"Libra:grand_sum_commitment");
224 libra_commitments[2] = transcript->template receive_from_prover<Commitment>(
"Libra:quotient_commitment");
228 auto& claimed = sumcheck_output.claimed_evaluations;
230 claimed.get_groups_to_be_concatenated_shifted(),
std::span<const FF>(sumcheck_output.challenge));
233 auto combined_unshifted_comms = commitments.get_pcs_unshifted();
234 auto combined_unshifted_evals = claimed.get_pcs_unshifted();
238 auto combined_shifted_comms = commitments.get_pcs_to_be_shifted();
239 RefVector<FF> combined_shifted_evals(claimed.get_pcs_shifted());
240 for (
auto& eval : concat_shift_evals) {
249 ClaimBatcher claim_batcher{ .unshifted = ClaimBatch{ combined_unshifted_comms, combined_unshifted_evals },
250 .shifted = ClaimBatch{ combined_shifted_comms, combined_shifted_evals } };
253 if constexpr (IsRecursive) {
254 commitment_one = Commitment::one(
builder);
256 commitment_one = Commitment::one();
259 auto [opening_claim, consistency_checked] =
260 Shplemini::compute_batch_opening_claim(padding_indicator_array,
262 sumcheck_output.challenge,
267 sumcheck_output.claimed_libra_evaluation);
269 auto pairing_points = PCS::reduce_verify_batch_opening_claim(
std::move(opening_claim), transcript);
271 vinfo(
"Translator Verifier: sumcheck verified: ", sumcheck_output.verified);
272 vinfo(
"Translator Verifier: consistency checked: ", consistency_checked);
274 return { pairing_points, sumcheck_output.verified && consistency_checked };
#define BB_ASSERT(expression,...)
#define BB_ASSERT_EQ(actual, expected,...)
bb::field< bb::Bn254FrParams > FF
#define BB_BENCH_NAME(name)
typename Curve::ScalarField FF
typename Curve::BaseField BF
static constexpr RepeatedCommitmentsData REPEATED_COMMITMENTS
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
std::string to_string(bb::avm2::ValueTag tag)
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.