Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
flavor_concepts.hpp
Go to the documentation of this file.
1#pragma once
2
3// Establish concepts for testing flavor attributes
6#include <string>
7namespace bb {
8// clang-format off
9
10#ifdef STARKNET_GARAGA_FLAVORS
11template <typename T>
12concept IsUltraHonk = IsAnyOf<T, UltraFlavor, UltraKeccakFlavor, UltraStarknetFlavor, UltraKeccakZKFlavor, UltraStarknetZKFlavor, UltraZKFlavor>;
13#else
14template <typename T>
16#endif
17template <typename T>
19
20template <typename T>
21concept IsMegaFlavor = IsAnyOf<T, MegaFlavor, MegaZKFlavor, MegaAvmFlavor,
22 MegaRecursiveFlavor_<UltraCircuitBuilder>,
23 MegaRecursiveFlavor_<MegaCircuitBuilder>,
24 MegaAvmRecursiveFlavor_<UltraCircuitBuilder>,
25 MegaZKRecursiveFlavor_<MegaCircuitBuilder>,
26 MegaZKRecursiveFlavor_<UltraCircuitBuilder>>;
27
28template <typename T>
30
31// Whether the Flavor has randomness at the end of its trace to randomise commitments and evaluations of its polynomials
32// hence requiring an adjustment to the round univariates via the RowDisablingPolynomial.
33// This is not the case for Translator, where randomness resides in different parts of the trace and the locations will
34// be reflected via Translator relations.
36template <typename T> concept UseRowDisablingPolynomial = !IsTranslatorFlavor<T>;
37
38
39
40template <typename T>
42 UltraRecursiveFlavor_<MegaCircuitBuilder>,
43 UltraZKRecursiveFlavor_<UltraCircuitBuilder>,
44 UltraZKRecursiveFlavor_<MegaCircuitBuilder>,
45 MegaRecursiveFlavor_<UltraCircuitBuilder>,
46 MegaRecursiveFlavor_<MegaCircuitBuilder>,
47 MegaZKRecursiveFlavor_<MegaCircuitBuilder>,
48 MegaZKRecursiveFlavor_<UltraCircuitBuilder>,
49 MegaAvmRecursiveFlavor_<UltraCircuitBuilder>,
50 TranslatorRecursiveFlavor,
51 ECCVMRecursiveFlavor,
52 MultilinearBatchingRecursiveFlavor,
53 avm2::AvmRecursiveFlavor>;
54
55template <typename T>
57
58template <typename T>
60
61// This concept is relevant for the Sumcheck Prover, where the logic differs between BN254 and Grumpkin
63
64// Flavors whose Sumcheck round univariates are committed (sent as commitment + evals at 0,1)
65// rather than sent in the clear. The committed data is later verified via Shplemini.
66template <typename T> concept UsesCommittedSumcheck = IsGrumpkinFlavor<T>;
67template <typename Container, typename Element>
68inline std::string flavor_get_label(Container&& container, const Element& element) {
69 for (auto [label, data] : zip_view(container.get_labels(), container.get_all())) {
70 if (&data == &element) {
71 return label;
72 }
73 }
74 return "(unknown label)";
75}
76
77// Whether a flavor includes a Gemini masking polynomial in its entities.
78// Defaults to Flavor::HasZK; flavors that define HasGeminiMasking = false (e.g., MegaZKFlavor)
79// opt out because a separate circuit provides the masking polynomial in the batched PCS.
80template <typename Flavor>
82{
83 if constexpr (requires { Flavor::HasGeminiMasking; }) {
84 return Flavor::HasGeminiMasking;
85 } else {
86 return Flavor::HasZK;
87 }
88}
89
90// clang-format on
91} // namespace bb
static constexpr bool HasZK
const std::vector< MemoryValue > data
bb::curve::BN254::Element Element
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr bool flavor_has_gemini_masking()
std::string flavor_get_label(Container &&container, const Element &element)