Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
crs_factory.hpp
Go to the documentation of this file.
1#pragma once
7#include <cstddef>
8
9namespace bb::pairing {
10struct miller_lines;
11} // namespace bb::pairing
12
14
15template <typename Curve> class Crs {
16 public:
17 virtual ~Crs() = default;
18};
19
20// Crs specialization for bn254
21template <> class Crs<curve::BN254> {
23
24 public:
25 // base class best practices
26 Crs() = default;
27 Crs(const Crs&) = delete;
28 Crs(Crs&&) noexcept = default;
29 Crs& operator=(const Crs&) = delete;
30 Crs& operator=(Crs&&) = delete;
31 virtual ~Crs() = default;
32
36 virtual std::span<Curve::AffineElement> get_monomial_points() = 0;
37 virtual size_t get_monomial_size() const = 0;
38
43 virtual Curve::AffineElement get_g1_identity() const = 0;
48 virtual bb::pairing::miller_lines const* get_precomputed_g2_lines() const = 0;
49
50 virtual Curve::G2AffineElement get_g2x() const = 0;
51};
52
53// Crs specialization for Grumpkin
54template <> class Crs<curve::Grumpkin> {
56
57 public:
58 // base class best practices
59 Crs() = default;
60 Crs(const Crs&) = delete;
61 Crs(Crs&&) = default;
62 Crs& operator=(const Crs&) = delete;
63 Crs& operator=(Crs&&) = delete;
64 virtual ~Crs() = default;
65
70 virtual size_t get_monomial_size() const = 0;
71
77};
78
83template <typename Curve> class CrsFactory {
84 public:
85 // base class best practices
86 CrsFactory() = default;
87 CrsFactory(const CrsFactory&) = delete;
88 CrsFactory(CrsFactory&&) noexcept = default;
89 CrsFactory& operator=(const CrsFactory&) = delete;
90 CrsFactory& operator=(CrsFactory&&) noexcept = default;
91 virtual ~CrsFactory() = default;
92 virtual std::shared_ptr<bb::srs::factories::Crs<Curve>> get_crs(size_t) = 0;
93 std::shared_ptr<bb::srs::factories::Crs<Curve>> get_verifier_crs() { return get_crs(1); };
94};
95
96} // namespace bb::srs::factories
typename Group::affine_element AffineElement
Definition grumpkin.hpp:56
virtual size_t get_monomial_size() const =0
virtual std::span< Curve::AffineElement > get_monomial_points()=0
Returns the monomial points in a form to be consumed by scalar_multiplication pippenger algorithm.
virtual Curve::AffineElement get_g1_identity() const =0
Returns the first G_1 element from the CRS, used by the Shplonk verifier to compute the final commtim...
CrsFactory(const CrsFactory &)=delete
CrsFactory(CrsFactory &&) noexcept=default
virtual ~Crs()=default
Entry point for Barretenberg command-line interface.
@ BN254
Definition types.hpp:10
STL namespace.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13