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
11
12namespace bb {
13
18template <typename Curve> struct MultilinearBatchingVerifierClaim {
19 using FF = typename Curve::ScalarField;
21
22 std::vector<FF> challenge; // Evaluation point r
23 FF non_shifted_evaluation; // Claimed value P(r)
24 FF shifted_evaluation; // Claimed value P_shifted(r)
26 Commitment shifted_commitment; // Commitment [P_shifted]
27
31 template <typename RecursiveCurve>
32 static MultilinearBatchingVerifierClaim stdlib_from_native(
33 typename RecursiveCurve::Builder* builder,
36 {
38
39 for (auto& element : native_claim.challenge) {
40 result.challenge.emplace_back(FF::from_witness(builder, element));
41 }
42
43 result.non_shifted_evaluation = FF::from_witness(builder, native_claim.non_shifted_evaluation);
44 result.shifted_evaluation = FF::from_witness(builder, native_claim.shifted_evaluation);
45 result.non_shifted_commitment = Commitment::from_witness(builder, native_claim.non_shifted_commitment);
46 result.shifted_commitment = Commitment::from_witness(builder, native_claim.shifted_commitment);
47
48 return result;
49 }
50
54 template <typename T>
55 T get_value()
56 requires Curve::is_stdlib_type
57 {
58 T native_claim;
59 native_claim.challenge.reserve(challenge.size());
60
61 for (auto& recursive_challenge : challenge) {
62 native_claim.challenge.emplace_back(recursive_challenge.get_value());
63 }
64 native_claim.non_shifted_evaluation = non_shifted_evaluation.get_value();
65 native_claim.shifted_evaluation = shifted_evaluation.get_value();
66 native_claim.non_shifted_commitment = non_shifted_commitment.get_value();
67 native_claim.shifted_commitment = shifted_commitment.get_value();
68
69 return native_claim;
70 }
71
75 template <typename Codec, typename HashFn> FF hash_with_origin_tagging(const OriginTag& tag) const
76 {
77 constexpr bool in_circuit = Curve::is_stdlib_type;
78 std::vector<FF> claim_elements;
79
80 auto append_tagged = [&]<typename U>(const U& component) {
81 auto frs = bb::tag_and_serialize<in_circuit, Codec>(component, tag);
82 claim_elements.insert(claim_elements.end(), frs.begin(), frs.end());
83 };
84
85 for (const auto& element : challenge) {
86 append_tagged(element);
87 }
88
89 append_tagged(non_shifted_evaluation);
90 append_tagged(shifted_evaluation);
91 append_tagged(non_shifted_commitment);
92 append_tagged(shifted_commitment);
93
94 bb::unset_free_witness_tags<in_circuit, FF>(claim_elements);
95
96 return HashFn::hash(claim_elements);
97 }
98
102 template <typename TranscriptType> FF hash_with_origin_tagging(const TranscriptType& transcript) const
103 {
104 const OriginTag tag = bb::extract_transcript_tag(transcript);
105 return hash_with_origin_tagging<typename TranscriptType::Codec, typename TranscriptType::HashFunction>(tag);
106 }
107};
108
109} // namespace bb
static constexpr bool is_stdlib_type
Definition grumpkin.hpp:69
typename Group::affine_element AffineElement
Definition grumpkin.hpp:63
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...
Verifier's claim for multilinear batching - contains commitments and evaluation claims.