22 : transcript(
std::move(transcript))
28 HIDING_KERNEL_ULTRA_OPS,
29 "Number of ultra ops in the hiding kernel doesn't match the expected value.");
30 const size_t append_offset =
op_queue->get_append_offset_for_prover();
32 op_queue->merge_fixed_append(append_offset);
42 for (
size_t idx = 0; idx <
NUM_WIRES; idx++) {
43 reversed_batched_left_tables.
add_scaled(left_table[idx], degree_check_challenges[idx]);
45 return reversed_batched_left_tables.
reverse();
52 const std::vector<FF>& shplonk_batching_challenges,
55 const Polynomial& reversed_batched_left_tables,
56 const std::vector<FF>& evals)
60 Polynomial shplonk_batched_quotient(merged_table[0].size());
63 for (
size_t idx_table = 0; idx_table < 3; idx_table++) {
64 for (
size_t idx = 0; idx <
NUM_WIRES; idx++) {
65 FF challenge = shplonk_batching_challenges[(idx_table *
NUM_WIRES) + idx];
69 shplonk_batched_quotient.
add_scaled(left_table[idx], challenge);
70 }
else if (idx_table == 1) {
72 shplonk_batched_quotient.
add_scaled(right_table[idx], challenge);
75 shplonk_batched_quotient.
add_scaled(merged_table[idx], challenge);
78 if (!shplonk_batched_quotient.
is_empty()) {
79 shplonk_batched_quotient.
at(0) -= challenge * eval;
87 Polynomial reversed_batched_left_tables_copy(reversed_batched_left_tables);
88 if (!reversed_batched_left_tables_copy.
is_empty()) {
89 reversed_batched_left_tables_copy.
at(0) -= evals.back();
91 reversed_batched_left_tables_copy.
factor_roots(kappa_inv);
92 shplonk_batched_quotient.
add_scaled(reversed_batched_left_tables_copy, shplonk_batching_challenges.back());
94 return shplonk_batched_quotient;
99 const FF& shplonk_opening_challenge,
103 const std::vector<FF>& shplonk_batching_challenges,
107 const std::vector<FF>& evals)
111 Polynomial shplonk_partially_evaluated_batched_quotient(
std::move(shplonk_batched_quotient));
112 shplonk_partially_evaluated_batched_quotient *= -(shplonk_opening_challenge - kappa);
115 for (
size_t idx_table = 0; idx_table < 3; idx_table++) {
116 for (
size_t idx = 0; idx <
NUM_WIRES; idx++) {
117 FF challenge = shplonk_batching_challenges[(idx_table *
NUM_WIRES) + idx];
119 if (idx_table == 0) {
121 shplonk_partially_evaluated_batched_quotient.
add_scaled(left_table[idx], challenge);
122 }
else if (idx_table == 1) {
124 shplonk_partially_evaluated_batched_quotient.
add_scaled(right_table[idx], challenge);
127 shplonk_partially_evaluated_batched_quotient.
add_scaled(merged_table[idx], challenge);
130 if (!shplonk_partially_evaluated_batched_quotient.
is_empty()) {
131 shplonk_partially_evaluated_batched_quotient.
at(0) -= challenge * eval;
137 if (!reversed_batched_left_tables.
is_empty()) {
138 reversed_batched_left_tables.
at(0) -= evals.back();
140 shplonk_partially_evaluated_batched_quotient.
add_scaled(reversed_batched_left_tables,
141 shplonk_batching_challenges.back() *
142 (shplonk_opening_challenge - kappa) *
143 (shplonk_opening_challenge - kappa_inv).invert());
146 .opening_pair = { shplonk_opening_challenge,
FF(0) } };
148 return shplonk_opening_claim;
169 left_table =
op_queue->construct_table_columns_up_to_tail();
170 right_table =
op_queue->construct_current_ultra_ops_subtable_columns();
174 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
183 transcript->send_to_verifier(
"REVERSED_BATCHED_LEFT_TABLES",
187 const FF kappa =
transcript->template get_challenge<FF>(
"kappa");
188 const FF kappa_inv = kappa.
invert();
191 std::vector<FF> evals;
193 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
194 evals.emplace_back(left_table[idx].evaluate(kappa));
197 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
198 evals.emplace_back(right_table[idx].evaluate(kappa));
201 for (
size_t idx = 0; idx <
NUM_WIRES; ++idx) {
202 evals.emplace_back(merged_table[idx].evaluate(kappa));
207 evals.emplace_back(reversed_batched_left_tables.
evaluate(kappa_inv));
208 transcript->send_to_verifier(
"REVERSED_BATCHED_LEFT_TABLES_EVAL", evals.back());
211 std::vector<FF> shplonk_batching_challenges =
218 shplonk_batching_challenges,
221 reversed_batched_left_tables,
227 FF shplonk_opening_challenge =
transcript->template get_challenge<FF>(
"shplonk_opening_challenge");
231 shplonk_opening_challenge,
235 shplonk_batching_challenges,
238 reversed_batched_left_tables,
#define BB_ASSERT_EQ(actual, expected,...)
#define BB_BENCH_NAME(name)
Commitment commit(PolynomialSpan< const Fr > polynomial, bool has_duplicates_hint=false) const
Uses the ProverSRS to create a commitment to p(X)
static constexpr size_t compute_fixed_append_offset(size_t append_offset, bool include_zk_prefix=true)
static void compute_opening_proof(const CK &ck, const ProverOpeningClaim< Curve > &opening_claim, const std::shared_ptr< Transcript > &prover_trancript)
Computes the KZG commitment to an opening proof polynomial at a single evaluation point.
static constexpr size_t NUM_WIRES
std::shared_ptr< ECCOpQueue > op_queue
std::vector< FF > MergeProof
BB_PROFILE MergeProof construct_proof()
Prove proper construction of the aggregate Goblin ECC op queue polynomials T_j.
std::vector< std::string > labels_degree_check
Polynomial compute_degree_check_polynomial(const std::array< Polynomial, NUM_WIRES > &left_table, const std::vector< FF > °ree_check_challenges) const
Compute the batched polynomial for the degree check.
static OpeningClaim compute_shplonk_opening_claim(Polynomial &shplonk_batched_quotient, const FF &shplonk_opening_challenge, const std::array< Polynomial, NUM_WIRES > &left_table, const std::array< Polynomial, NUM_WIRES > &right_table, const std::array< Polynomial, NUM_WIRES > &merged_table, const std::vector< FF > &shplonk_batching_challenges, const FF &kappa, const FF &kappa_inv, Polynomial &reversed_batched_left_tables, const std::vector< FF > &evals)
Compute the partially evaluated Shplonk batched quotient and the resulting opening claim.
std::vector< std::string > labels_shplonk_batching_challenges
MergeProver(const std::shared_ptr< ECCOpQueue > &op_queue, std::shared_ptr< Transcript > transcript)
Create MergeProver.
std::shared_ptr< Transcript > transcript
CommitmentKey pcs_commitment_key
static Polynomial compute_shplonk_batched_quotient(const std::array< Polynomial, NUM_WIRES > &left_table, const std::array< Polynomial, NUM_WIRES > &right_table, const std::array< Polynomial, NUM_WIRES > &merged_table, const std::vector< FF > &shplonk_batching_challenges, const FF &kappa, const FF &kappa_inv, const Polynomial &reversed_batched_left_tables, const std::vector< FF > &evals)
Compute the batched Shplonk quotient polynomial.
size_t fixed_append_shift_size
bb::CommitmentKey< Curve > CommitmentKey
void add_scaled(PolynomialSpan< const Fr > other, const Fr &scaling_factor)
adds the polynomial q(X) 'other', multiplied by a scaling factor.
Fr evaluate(const Fr &z) const
Polynomial reverse() const
Returns the polynomial equal to the reverse of self.
Fr & at(size_t index)
Our mutable accessor, unlike operator[]. We abuse precedent a bit to differentiate at() and operator[...
void factor_roots(const Fr &root)
Divides p(X) by (X-r) in-place. Assumes that p(rⱼ)=0 for all j.
Polynomial p and an opening pair (r,v) such that p(r) = v.
static constexpr size_t ZK_ULTRA_OPS
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::string to_string(bb::avm2::ValueTag tag)
constexpr field invert() const noexcept