Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
multilinear_batching_claims.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Complete, auditors: [Sergei], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
8
12
13namespace bb {
14
19template <typename Curve> struct MultilinearBatchingVerifierClaim {
20 using FF = typename Curve::ScalarField;
22
23 std::vector<FF> challenge; // Evaluation point r
24 FF non_shifted_evaluation; // Claimed value P(r)
25 FF shifted_evaluation; // Claimed value P_shifted(r)
27 Commitment shifted_commitment; // Commitment [P_shifted]
28
32 template <typename RecursiveCurve>
33 static MultilinearBatchingVerifierClaim stdlib_from_native(
34 typename RecursiveCurve::Builder* builder,
37 {
39 result.challenge.reserve(native_claim.challenge.size());
40
41 for (auto& element : native_claim.challenge) {
42 result.challenge.emplace_back(FF::from_witness(builder, element));
43 }
44
45 result.non_shifted_evaluation = FF::from_witness(builder, native_claim.non_shifted_evaluation);
46 result.shifted_evaluation = FF::from_witness(builder, native_claim.shifted_evaluation);
47 result.non_shifted_commitment = Commitment::from_witness(builder, native_claim.non_shifted_commitment);
48 result.shifted_commitment = Commitment::from_witness(builder, native_claim.shifted_commitment);
49
50 return result;
51 }
52
56 template <typename T>
57 T get_value()
58 requires Curve::is_stdlib_type
59 {
60 T native_claim;
61 native_claim.challenge.reserve(challenge.size());
62
63 for (auto& recursive_challenge : challenge) {
64 native_claim.challenge.emplace_back(recursive_challenge.get_value());
65 }
66 native_claim.non_shifted_evaluation = non_shifted_evaluation.get_value();
67 native_claim.shifted_evaluation = shifted_evaluation.get_value();
68 native_claim.non_shifted_commitment = non_shifted_commitment.get_value();
69 native_claim.shifted_commitment = shifted_commitment.get_value();
70
71 return native_claim;
72 }
73
77 template <typename Codec, typename HashFn> FF hash_with_origin_tagging(const OriginTag& tag) const
78 {
79 constexpr bool in_circuit = Curve::is_stdlib_type;
80 std::vector<FF> claim_elements;
81
82 auto append_tagged = [&]<typename U>(const U& component) {
83 auto frs = bb::tag_and_serialize<in_circuit, Codec>(component, tag);
84 claim_elements.insert(claim_elements.end(), frs.begin(), frs.end());
85 };
86
87 for (const auto& element : challenge) {
88 append_tagged(element);
89 }
90
91 append_tagged(non_shifted_evaluation);
92 append_tagged(shifted_evaluation);
93 // Note that commitments have been already deserialized and the point at infinity is constrained to (0,0)).
94 append_tagged(non_shifted_commitment);
95 append_tagged(shifted_commitment);
96
97 bb::unset_free_witness_tags<in_circuit, FF>(claim_elements);
98
99 return HashFn::hash(claim_elements);
100 }
101
105 template <typename TranscriptType> FF hash_with_origin_tagging(const TranscriptType& transcript) const
106 {
107 const OriginTag tag = bb::extract_transcript_tag(transcript);
108 return hash_with_origin_tagging<typename TranscriptType::Codec, typename TranscriptType::HashFunction>(tag);
109 }
110};
111
121
122 std::vector<FF> challenge; // Evaluation point r
123 FF non_shifted_evaluation; // Claimed value P(r)
124 FF shifted_evaluation; // Claimed value P_shifted(r)
126 Polynomial shifted_polynomial; // The shiftable polynomial (pre-shift form)
128 Commitment shifted_commitment; // Commitment [P_shifted]
129 size_t dyadic_size; // Size of the polynomial domain
130
141
142#ifndef NDEBUG
148#endif
149};
150
151} // namespace bb
typename Group::affine_element AffineElement
Definition bn254.hpp:22
bb::fr ScalarField
Definition bn254.hpp:18
static constexpr bool is_stdlib_type
Definition grumpkin.hpp:67
typename Group::affine_element AffineElement
Definition grumpkin.hpp:64
AluTraceBuilder builder
Definition alu.test.cpp:124
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
OriginTag extract_transcript_tag(const TranscriptType &transcript)
Extract origin tag context from a transcript.
This file contains part of the logic for the Origin Tag mechanism that tracks the use of in-circuit p...
Prover's claim for multilinear batching - contains polynomials and their evaluation claims.
MultilinearBatchingVerifierClaim< curve::BN254 > to_verifier_claim_for_testing() const
bool compare_with_verifier_claim(const MultilinearBatchingVerifierClaim< curve::BN254 > &verifier_claim) const
Debug helper to compare prover claim against verifier claim.
Verifier's claim for multilinear batching - contains commitments and evaluation claims.
VectorField result