96 if (consumed_srs >
srs->get_monomial_size()) {
99 " points with an SRS of size ",
100 srs->get_monomial_size()));
103 G1 r = scalar_multiplication::pippenger_unsafe<Curve>(polynomial, point_table);
115 size_t max_batch_size = std::numeric_limits<size_t>::max())
const
122 std::vector<Commitment> commitments;
124 for (
size_t i = 0; i < polynomials.size();) {
126 size_t batch_size = std::min(max_batch_size, polynomials.size() - i);
127 size_t batch_end = i + batch_size;
133 for (
auto& polynomial : polynomials.subspan(i, batch_end - i)) {
135 size_t consumed_srs = polynomial.start_index() + polynomial.size();
136 if (consumed_srs >
srs->get_monomial_size()) {
139 " points with an SRS of size ",
140 srs->get_monomial_size()));
142 scalar_spans.emplace_back(polynomial.coeffs());
143 points_spans.emplace_back(point_table);
148 for (
const auto& result : results) {
149 commitments.emplace_back(result);
162 size_t max_batch_size = std::numeric_limits<size_t>::max())
165 for (
size_t i = 0; i < commitments.size(); ++i) {
166 transcript->send_to_verifier(
labels[i], commitments[i]);
177 wires.push_back(poly);
#define BB_BENCH_NAME(name)
CommitmentKey object over a pairing group 𝔾₁.
std::vector< Commitment > batch_commit(RefSpan< Polynomial< Fr > > polynomials, size_t max_batch_size=std::numeric_limits< size_t >::max()) const
Batch commitment to multiple polynomials.
typename Curve::AffineElement G1
typename Curve::ScalarField Fr
typename Curve::AffineElement Commitment
CommitmentKey(const size_t num_points)
Construct a new Kate Commitment Key object from existing SRS.
Commitment commit(PolynomialSpan< const Fr > polynomial) const
Uses the ProverSRS to create a commitment to p(X)
bool initialized() const
Checks the commitment key is properly initialized.
std::shared_ptr< srs::factories::Crs< Curve > > srs
CommitBatch start_batch()
static size_t get_num_needed_srs_points(size_t num_points)
Structured polynomial class that represents the coefficients 'a' of a_0 + a_1 x .....
void mask()
Add random values to the coefficients of a polynomial. In practice, this is used for ensuring the com...
A template class for a reference vector. Behaves as if std::vector<T&> was possible.
typename Group::affine_element AffineElement
static std::vector< AffineElement > batch_multi_scalar_mul(std::span< std::span< const AffineElement > > points, std::span< std::span< ScalarField > > scalars, bool handle_edge_cases=true) noexcept
Compute multiple multi-scalar multiplications.
std::string format(Args... args)
constexpr T round_up_power_2(const T in)
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::vector< std::string > labels
std::vector< Commitment > commit_and_send_to_verifier(auto transcript, size_t max_batch_size=std::numeric_limits< size_t >::max())
void add_to_batch(Polynomial< Fr > &poly, const std::string &label, bool mask)
RefVector< Polynomial< Fr > > wires
void throw_or_abort(std::string const &err)