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 {
8class TranslatorShortMonomialFlavor;
9
10// clang-format off
11
12class ECCVMShortMonomialFlavor;
13
14#ifdef STARKNET_GARAGA_FLAVORS
15template <typename T>
16concept IsUltraHonk = IsAnyOf<T, UltraFlavor, UltraKeccakFlavor, UltraStarknetFlavor, UltraKeccakZKFlavor, UltraStarknetZKFlavor, UltraZKFlavor>;
17#else
18template <typename T>
20#endif
21template <typename T>
23
24template <typename T>
25concept IsMegaFlavor = IsAnyOf<T, MegaFlavor, MegaZKFlavor, MegaAvmFlavor,
26 MegaRecursiveFlavor_<UltraCircuitBuilder>,
27 MegaRecursiveFlavor_<MegaCircuitBuilder>,
28 MegaAvmRecursiveFlavor_<UltraCircuitBuilder>,
29 MegaZKRecursiveFlavor_<MegaCircuitBuilder>,
30 MegaZKRecursiveFlavor_<UltraCircuitBuilder>>;
31
32template <typename T>
34
35// Whether the Flavor has randomness at the end of its trace to randomise commitments and evaluations of its polynomials
36// hence requiring an adjustment to the round univariates via the RowDisablingPolynomial.
37// This is not the case for Translator, where randomness resides in different parts of the trace and the locations will
38// be reflected via Translator relations.
39template <typename T>
41template <typename T> concept UseRowDisablingPolynomial = !IsTranslatorFlavor<T>;
42
43
44
45template <typename T>
47 UltraRecursiveFlavor_<MegaCircuitBuilder>,
48 UltraZKRecursiveFlavor_<UltraCircuitBuilder>,
49 UltraZKRecursiveFlavor_<MegaCircuitBuilder>,
50 MegaRecursiveFlavor_<UltraCircuitBuilder>,
51 MegaRecursiveFlavor_<MegaCircuitBuilder>,
52 MegaZKRecursiveFlavor_<MegaCircuitBuilder>,
53 MegaZKRecursiveFlavor_<UltraCircuitBuilder>,
54 MegaAvmRecursiveFlavor_<UltraCircuitBuilder>,
55 TranslatorRecursiveFlavor,
56 ECCVMRecursiveFlavor,
57 MultilinearBatchingRecursiveFlavor,
58 avm2::AvmRecursiveFlavor>;
59
60template <typename T>
62
63template <typename T>
65
66// This concept is relevant for the Sumcheck Prover, where the logic differs between BN254 and Grumpkin
68
69// Flavors whose Sumcheck round univariates are committed (sent as commitment + evals at 0,1)
70// rather than sent in the clear. The committed data is later verified via Shplemini.
71template <typename T> concept UsesCommittedSumcheck = IsGrumpkinFlavor<T>;
72template <typename Container, typename Element>
73inline std::string flavor_get_label(Container&& container, const Element& element) {
74 for (auto [label, data] : zip_view(container.get_labels(), container.get_all())) {
75 if (&data == &element) {
76 return label;
77 }
78 }
79 return "(unknown label)";
80}
81
82// Whether a flavor includes a Gemini masking polynomial in its entities.
83// Defaults to Flavor::HasZK; flavors that define HasGeminiMasking = false (e.g., MegaZKFlavor)
84// opt out because a separate circuit provides the masking polynomial in the batched PCS.
85template <typename Flavor>
87{
88 if constexpr (requires { Flavor::HasGeminiMasking; }) {
89 return Flavor::HasGeminiMasking;
90 } else {
91 return Flavor::HasZK;
92 }
93}
94
95// clang-format on
96} // namespace bb
static constexpr bool HasZK
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)
std::byte * data
Curve::Element Element