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);
116 size_t max_batch_size = std::numeric_limits<size_t>::max())
const
123 std::vector<Commitment> commitments;
125 for (
size_t i = 0; i < polynomials.size();) {
127 size_t batch_size = std::min(max_batch_size, polynomials.size() - i);
128 size_t batch_end = i + batch_size;
134 for (
auto& polynomial : polynomials.subspan(i, batch_end - i)) {
136 size_t consumed_srs = polynomial.start_index() + polynomial.size();
137 if (consumed_srs >
srs->get_monomial_size()) {
140 " points with an SRS of size ",
141 srs->get_monomial_size()));
143 scalar_spans.emplace_back(polynomial.coeffs());
144 points_spans.emplace_back(point_table);
149 for (
const auto& result : results) {
150 commitments.emplace_back(result);
163 size_t max_batch_size = std::numeric_limits<size_t>::max())
166 for (
size_t i = 0; i < commitments.size(); ++i) {
167 transcript->send_to_verifier(
labels[i], commitments[i]);
178 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)