35 const FF& pow_kappa_minus_one,
36 const std::vector<FF>& degree_check_challenges)
const
38 bool degree_check_verified =
true;
39 FF degree_check_diff(0);
40 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
41 degree_check_diff += evals[idx] * degree_check_challenges[idx];
43 degree_check_diff -= evals.back() * pow_kappa_minus_one;
44 if constexpr (IsRecursive) {
45 degree_check_verified &= degree_check_diff.get_value() == 0;
46 degree_check_diff.assert_equal(
FF(0),
"assert_equal: merge degree identity failed in Merge Verifier");
48 degree_check_verified &= degree_check_diff == 0;
51 return degree_check_verified;
56 const std::vector<Commitment>& table_commitments,
58 const FF& shplonk_opening_challenge,
59 const std::vector<FF>& shplonk_batching_challenges,
62 const std::vector<FF>& evals)
const
70 for (
auto& commitment : table_commitments) {
73 if constexpr (IsRecursive) {
74 batch_opening_claim.
commitments.emplace_back(Commitment::one(kappa.get_context()));
76 batch_opening_claim.
commitments.emplace_back(Commitment::one());
80 batch_opening_claim.
scalars = { -(shplonk_opening_challenge - kappa) };
81 for (
auto& scalar : shplonk_batching_challenges) {
84 batch_opening_claim.
scalars.back() *=
85 (shplonk_opening_challenge - kappa) * (shplonk_opening_challenge - kappa_inv).invert();
87 batch_opening_claim.
scalars.emplace_back(
FF(0));
88 for (
size_t idx = 0; idx < evals.size(); idx++) {
89 if (idx < evals.size() - 1) {
90 batch_opening_claim.
scalars.back() -= evals[idx] * shplonk_batching_challenges[idx];
92 batch_opening_claim.
scalars.back() -= shplonk_batching_challenges.back() * evals.back() *
93 (shplonk_opening_challenge - kappa) *
94 (shplonk_opening_challenge - kappa_inv).invert();
100 return batch_opening_claim;
117 transcript->load_proof(proof);
122 const FF shift_size = transcript->template receive_from_prover<FF>(
"shift_size");
124 if constexpr (IsRecursive) {
125 BB_ASSERT_GT(uint32_t(shift_size.get_value()), 0U,
"Shift size should always be bigger than 0");
128 BB_ASSERT_GT(shift_size, 0U,
"Shift size should always be bigger than 0");
136 std::vector<Commitment> table_commitments;
137 table_commitments.reserve((3 * NUM_WIRES) + 1);
138 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
142 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
146 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
147 table_commitments.emplace_back(
148 transcript->template receive_from_prover<Commitment>(
"MERGED_TABLE_" +
std::to_string(idx)));
149 merged_table_commitments[idx] = table_commitments.back();
153 std::vector<FF> degree_check_challenges = transcript->template get_challenges<FF>(labels_degree_check);
156 table_commitments.emplace_back(
157 transcript->template receive_from_prover<Commitment>(
"REVERSED_BATCHED_LEFT_TABLES"));
160 std::vector<FF> shplonk_batching_challenges =
161 transcript->template get_challenges<FF>(labels_shplonk_batching_challenges);
164 const FF kappa = transcript->template get_challenge<FF>(
"kappa");
165 const FF kappa_inv = kappa.invert();
166 const FF pow_kappa = kappa.pow(shift_size);
167 const FF pow_kappa_minus_one = pow_kappa * kappa_inv;
170 std::vector<FF> evals;
171 evals.reserve((3 * NUM_WIRES) + 1);
172 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
173 evals.emplace_back(transcript->template receive_from_prover<FF>(
"LEFT_TABLE_EVAL_" +
std::to_string(idx)));
175 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
176 evals.emplace_back(transcript->template receive_from_prover<FF>(
"RIGHT_TABLE_EVAL_" +
std::to_string(idx)));
178 for (
size_t idx = 0; idx < NUM_WIRES; ++idx) {
179 evals.emplace_back(transcript->template receive_from_prover<FF>(
"MERGED_TABLE_EVAL_" +
std::to_string(idx)));
183 evals.emplace_back(transcript->template receive_from_prover<FF>(
"REVERSED_BATCHED_LEFT_TABLES_EVAL"));
186 bool concatenation_verified = check_concatenation_identities(evals, pow_kappa);
189 bool degree_check_verified = check_degree_identity(evals, pow_kappa_minus_one, degree_check_challenges);
193 transcript->template receive_from_prover<Commitment>(
"SHPLONK_BATCHED_QUOTIENT");
196 FF shplonk_opening_challenge = transcript->template get_challenge<FF>(
"shplonk_opening_challenge");
200 shplonk_batched_quotient,
201 shplonk_opening_challenge,
202 shplonk_batching_challenges,
211 PairingPoints pairing_points = PCS::reduce_verify_batch_opening_claim(
std::move(batch_opening_claim), transcript);
213 vinfo(
"Merge Verifier: degree check passed: ", degree_check_verified ?
"true" :
"false");
214 vinfo(
"Merge Verifier: concatenation check passed: ", concatenation_verified ?
"true" :
"false");
216 return { pairing_points, merged_table_commitments, degree_check_verified && concatenation_verified };
BatchOpeningClaim< Curve > compute_shplonk_opening_claim(const std::vector< Commitment > &table_commitments, const Commitment &shplonk_batched_quotient, const FF &shplonk_opening_challenge, const std::vector< FF > &shplonk_batching_challenges, const FF &kappa, const FF &kappa_inv, const std::vector< FF > &evals) const