Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
095f3aa
Translator: concatenation layout, computable precomputed selectors, P…
iakovenkos Feb 8, 2026
e618d6d
clean up verifier code
iakovenkos Feb 8, 2026
bddc74b
clean up + docs
iakovenkos Feb 9, 2026
4f8a9a4
expand tests
iakovenkos Feb 9, 2026
c4a90ef
fixed soundness issue + more relation tests
iakovenkos Feb 9, 2026
e3c4685
shplemini concatenated tests clean up
iakovenkos Feb 9, 2026
7cd0c37
more test clean up
iakovenkos Feb 9, 2026
da81f0f
rm unneeded selectors
iakovenkos Feb 9, 2026
54d253b
rm magic constants
iakovenkos Feb 9, 2026
ed0e2b2
cleaner getters
iakovenkos Feb 10, 2026
1c3d6f5
rm another lagrange
iakovenkos Feb 10, 2026
9dff96b
Merge remote-tracking branch 'origin/merge-train/barretenberg' into s…
iakovenkos Feb 17, 2026
ca9cd5e
fix gate count tests, consistency test, and some comments
iakovenkos Feb 17, 2026
a7e9e86
fix mock proof size test
iakovenkos Feb 17, 2026
d681ac1
fix bb tests
iakovenkos Feb 17, 2026
a6f0a8e
gate count upd for rollup
iakovenkos Feb 17, 2026
a330fd3
clean up translator flavor
iakovenkos Feb 17, 2026
37e64ba
upd chonk proof size constant
iakovenkos Feb 17, 2026
45ed5b7
clean up after the review
iakovenkos Feb 18, 2026
f91bdc2
fix: upd toml files broken by translator revision (#20612)
iakovenkos Feb 18, 2026
a2efe67
Merge remote-tracking branch 'origin/merge-train/barretenberg' into s…
iakovenkos Feb 18, 2026
e06fc6f
fix toml
iakovenkos Feb 18, 2026
1926d68
upd comments in sumcheck
iakovenkos Feb 18, 2026
e7db432
love updating these huge files
iakovenkos Feb 18, 2026
4278e74
Merge branch 'merge-train/barretenberg' into si/translator-revised
iakovenkos Feb 18, 2026
bc4e52f
comments.
suyash67 Feb 18, 2026
59dc4bd
fix translator transcript tests
iakovenkos Feb 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cd ..
# - Generate a hash for versioning: sha256sum bb-chonk-inputs.tar.gz
# - Upload the compressed results: aws s3 cp bb-chonk-inputs.tar.gz s3://aztec-ci-artifacts/protocol/bb-chonk-inputs-[hash(0:8)].tar.gz
# Note: In case of the "Test suite failed to run ... Unexpected token 'with' " error, need to run: docker pull aztecprotocol/build:3.0
pinned_short_hash="600b85bd"
pinned_short_hash="53ce2d4f"
pinned_chonk_inputs_url="https://aztec-ci-artifacts.s3.us-east-2.amazonaws.com/protocol/bb-chonk-inputs-${pinned_short_hash}.tar.gz"

script_path="$(cd "$(dirname "${BASH_SOURCE[0]}")/scripts" && pwd)/$(basename "${BASH_SOURCE[0]}")"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@

#pragma once
#include "barretenberg/common/ref_vector.hpp"
#include "barretenberg/common/throw_or_abort.hpp"
#include "barretenberg/common/zip_view.hpp"
#include "barretenberg/numeric/bitop/get_msb.hpp"
#include <optional>

namespace bb {

/**
* @brief Logic to support batching opening claims for unshifted, shifted and interleaved polynomials in Shplemini
* @details Stores references to the commitments/evaluations of unshifted, shifted and interleaved polynomials to be
* @brief Logic to support batching opening claims for unshifted and shifted polynomials in Shplemini
* @details Stores references to the commitments/evaluations of unshifted and shifted polynomials to be
* batch opened via Shplemini. Aggregates the commitments and batching scalars for each batch into the corresponding
* containers for Shplemini. Computes the batched evaluation. Contains logic for computing the per-batch scalars
* used to batch each set of claims (see details below).
Expand All @@ -35,26 +33,12 @@ template <typename Curve> struct ClaimBatcher_ {
// scalar used for batching the claims, excluding the power of batching challenge \rho
Fr scalar = 0;
};
struct InterleavedBatch {
std::vector<RefVector<Commitment>> commitments_groups;
RefVector<Fr> evaluations;
std::vector<Fr> scalars_pos;
std::vector<Fr> scalars_neg;
Fr shplonk_denominator;
};

std::optional<Batch> unshifted; // commitments and evaluations of unshifted polynomials
std::optional<Batch> shifted; // commitments of to-be-shifted-by-1 polys, evals of their shifts
std::optional<InterleavedBatch> interleaved; // commitments to groups of polynomials to be combined by interleaving
// and evaluations of the resulting interleaved polynomials
std::optional<Batch> unshifted; // commitments and evaluations of unshifted polynomials
std::optional<Batch> shifted; // commitments of to-be-shifted-by-1 polys, evals of their shifts

Batch get_unshifted() { return (unshifted) ? *unshifted : Batch{}; }
Batch get_shifted() { return (shifted) ? *shifted : Batch{}; }
InterleavedBatch get_interleaved() { return (interleaved) ? *interleaved : InterleavedBatch{}; }
uint32_t get_groups_to_be_interleaved_size()
{
return (interleaved) ? static_cast<uint32_t>(interleaved->commitments_groups[0].size()) : 0;
}

Fr get_unshifted_batch_scalar() const { return unshifted ? unshifted->scalar : Fr{ 0 }; }

Expand Down Expand Up @@ -97,52 +81,25 @@ template <typename Curve> struct ClaimBatcher_ {
shifted->scalar =
r_challenge.invert() * (inverse_vanishing_eval_pos - nu_challenge * inverse_vanishing_eval_neg);
}

if (interleaved) {
const size_t interleaving_denominator_index = 2 * numeric::get_msb(get_groups_to_be_interleaved_size());

if (get_groups_to_be_interleaved_size() % 2 != 0) {
throw_or_abort("Interleaved groups size must be even");
}

Fr r_shift_pos = Fr(1);
Fr r_shift_neg = Fr(1);
interleaved->shplonk_denominator = inverted_vanishing_evals[interleaving_denominator_index];
for (size_t i = 0; i < get_groups_to_be_interleaved_size(); i++) {
interleaved->scalars_pos.push_back(r_shift_pos);
interleaved->scalars_neg.push_back(r_shift_neg);
if (i < get_groups_to_be_interleaved_size() - 1) {
// to avoid unnecessary multiplication gates in a circuit
r_shift_pos *= r_challenge;
r_shift_neg *= (-r_challenge);
}
}
}
}
/**
* @brief Append the commitments and scalars from each batch of claims to the Shplemini, vectors which subsequently
* @brief Append the commitments and scalars from each batch of claims to the Shplemini vectors which subsequently
* will be inputs to the batch mul;
* update the batched evaluation and the running batching challenge (power of rho) in place.
*
* @param commitments commitment inputs to the single Shplemini batch mul
* @param scalars scalar inputs to the single Shplemini batch mul
* @param batched_evaluation running batched evaluation of the committed multilinear polynomials
* @param rho multivariate batching challenge \rho
* @param rho_power current power of \rho used in the batching scalar
* @param shplonk_batching_pos and @param shplonk_batching_neg consecutive powers of the Shplonk batching
* challenge ν for the interleaved contributions
*/
void update_batch_mul_inputs_and_batched_evaluation(std::vector<Commitment>& commitments,
std::vector<Fr>& scalars,
Fr& batched_evaluation,
const Fr& rho,
Fr shplonk_batching_pos = { 0 },
Fr shplonk_batching_neg = { 0 })
const Fr& rho)
{
size_t num_powers = 0;
num_powers += unshifted.has_value() ? unshifted->commitments.size() : 0;
num_powers += shifted.has_value() ? shifted->commitments.size() : 0;
num_powers += interleaved.has_value() ? interleaved->evaluations.size() : 0;

Fr rho_power = Fr(1);
size_t power_idx = 0;
Expand Down Expand Up @@ -171,29 +128,6 @@ template <typename Curve> struct ClaimBatcher_ {
// i-th shifted commitments will be multiplied by ρ^{num_unshifted + i} and r⁻¹ ⋅ (1/(z−r) − ν/(z+r))
aggregate_claim_data_and_update_batched_evaluation(*shifted);
}
if (interleaved) {
if (get_groups_to_be_interleaved_size() % 2 != 0) {
throw_or_abort("Interleaved groups size must be even");
}

size_t group_idx = 0;
for (size_t j = 0; j < interleaved->commitments_groups.size(); j++) {
for (size_t i = 0; i < get_groups_to_be_interleaved_size(); i++) {
// The j-th commitment in group i is multiplied by ρ^{m+i} and ν^{d+1} \cdot r^j + ν^{d+2} ⋅(-r)^j
// where d is the log_circuit_size
commitments.emplace_back(std::move(interleaved->commitments_groups[j][i]));
scalars.emplace_back(-rho_power * interleaved->shplonk_denominator *
(shplonk_batching_pos * interleaved->scalars_pos[i] +
shplonk_batching_neg * interleaved->scalars_neg[i]));
}
batched_evaluation += interleaved->evaluations[group_idx] * rho_power;
power_idx++;
if (power_idx < num_powers) {
rho_power *= rho;
}
group_idx++;
}
}

BB_ASSERT_EQ(power_idx, num_powers);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "barretenberg/commitment_schemes/claim.hpp"
#include "barretenberg/commitment_schemes/claim_batcher.hpp"
#include "barretenberg/common/bb_bench.hpp"
#include "barretenberg/common/thread.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/transcript/transcript.hpp"

Expand Down Expand Up @@ -129,16 +128,10 @@ template <typename Curve> class GeminiProver_ {

Polynomial batched_unshifted; // linear combination of unshifted polynomials
Polynomial batched_to_be_shifted_by_one; // linear combination of to-be-shifted polynomials
Polynomial batched_interleaved; // linear combination of interleaved polynomials
// linear combination of the groups to be interleaved where polynomial i in the batched group is obtained by
// linearly combining the i-th polynomial in each group
std::vector<Polynomial> batched_group;

public:
RefVector<Polynomial> unshifted; // set of unshifted polynomials
RefVector<Polynomial> to_be_shifted_by_one; // set of polynomials to be left shifted by 1
RefVector<Polynomial> interleaved; // the interleaved polynomials used in Translator
std::vector<RefVector<Polynomial>> groups_to_be_interleaved; // groups of polynomials to be interleaved
RefVector<Polynomial> unshifted; // set of unshifted polynomials
RefVector<Polynomial> to_be_shifted_by_one; // set of polynomials to be left shifted by 1

PolynomialBatcher(const size_t full_batched_size)
: full_batched_size(full_batched_size)
Expand All @@ -148,22 +141,11 @@ template <typename Curve> class GeminiProver_ {

bool has_unshifted() const { return unshifted.size() > 0; }
bool has_to_be_shifted_by_one() const { return to_be_shifted_by_one.size() > 0; }
bool has_interleaved() const { return interleaved.size() > 0; }

// Set references to the polynomials to be batched
void set_unshifted(RefVector<Polynomial> polynomials) { unshifted = polynomials; }
void set_to_be_shifted_by_one(RefVector<Polynomial> polynomials) { to_be_shifted_by_one = polynomials; }

void set_interleaved(RefVector<Polynomial> results, std::vector<RefVector<Polynomial>> groups)
{
// Ensure the Gemini subprotocol for interleaved polynomials operates correctly
if (groups[0].size() % 2 != 0) {
throw_or_abort("Group size must be even ");
}
interleaved = results;
groups_to_be_interleaved = groups;
}

/**
* @brief Compute batched polynomial A₀ = F + G/X as the linear combination of all polynomials to be opened,
* where F is the linear combination of the unshifted polynomials and G is the linear combination of the
Expand Down Expand Up @@ -198,27 +180,6 @@ template <typename Curve> class GeminiProver_ {
full_batched += batched_to_be_shifted_by_one.shifted(); // A₀ += G/X
}

// compute the linear combination of the interleaved polynomials and groups
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glad we're getting rid of this!

if (has_interleaved()) {
batched_interleaved = Polynomial(full_batched_size);
for (size_t i = 0; i < groups_to_be_interleaved[0].size(); ++i) {
batched_group.push_back(Polynomial(full_batched_size));
}

for (size_t i = 0; i < groups_to_be_interleaved.size(); ++i) {
batched_interleaved.add_scaled(interleaved[i], running_scalar);
// Use parallel chunking for the batching operations
parallel_for([this, running_scalar, i](const ThreadChunk& chunk) {
for (size_t j = 0; j < groups_to_be_interleaved[0].size(); ++j) {
batched_group[j].add_scaled_chunk(chunk, groups_to_be_interleaved[i][j], running_scalar);
}
});
running_scalar *= challenge;
}

full_batched += batched_interleaved;
}

return full_batched;
}

Expand Down Expand Up @@ -249,51 +210,13 @@ template <typename Curve> class GeminiProver_ {

return { A_0_pos, A_0_neg };
};
/**
* @brief Compute the partially evaluated polynomials P₊(X, r) and P₋(X, -r)
*
* @details If the interleaved polynomials are set, the full partially evaluated identites A₀(r) and A₀(-r)
* contain the contributions of P₊(r^s) and P₋(r^s) respectively where s is the size of the interleaved
* group assumed even. This function computes P₊(X) = ∑ r^i Pᵢ(X) and P₋(X) = ∑ (-r)^i Pᵢ(X) where Pᵢ(X) is
* the i-th polynomial in the batched group.
* @param r_challenge partial evaluation challenge
* @return std::pair<Polynomial, Polynomial> {P₊, P₋}
*/

std::pair<Polynomial, Polynomial> compute_partially_evaluated_interleaved_polynomial(const Fr& r_challenge)
{
Polynomial P_pos(batched_group[0]);
Polynomial P_neg(batched_group[0]);

Fr current_r_shift_pos = r_challenge;
Fr current_r_shift_neg = -r_challenge;
for (size_t i = 1; i < batched_group.size(); i++) {
// Add r^i * Pᵢ(X) to P₊(X)
P_pos.add_scaled(batched_group[i], current_r_shift_pos);
// Add (-r)^i * Pᵢ(X) to P₋(X)
P_neg.add_scaled(batched_group[i], current_r_shift_neg);
// Update the current power of r
current_r_shift_pos *= r_challenge;
current_r_shift_neg *= -r_challenge;
}

return { P_pos, P_neg };
}

size_t get_group_size() { return batched_group.size(); }
};

static std::vector<Polynomial> compute_fold_polynomials(const size_t log_n,
std::span<const Fr> multilinear_challenge,
const Polynomial& A_0,
const bool& has_zk = false);

static std::pair<Polynomial, Polynomial> compute_partially_evaluated_batch_polynomials(
const size_t log_n,
PolynomialBatcher& polynomial_batcher,
const Fr& r_challenge,
const std::vector<Polynomial>& batched_groups_to_be_concatenated = {});

static std::vector<Claim> construct_univariate_opening_claims(const size_t log_n,
Polynomial&& A_0_pos,
Polynomial&& A_0_neg,
Expand Down Expand Up @@ -375,9 +298,6 @@ template <typename Curve> class GeminiVerifier_ {
* \frac{2 \cdot r^{2^{l-1}} \cdot A_{l}\left(r^{2^l}\right) - A_{l-1}\left( -r^{2^{l-1}} \right)\cdot
* \left(r^{2^{l-1}} (1-u_{l-1}) - u_{l-1}\right)} {r^{2^{l-1}} (1- u_{l-1}) + u_{l-1}}. \f}
*
* In the case of interleaving, the first "negative" evaluation has to be corrected by the contribution from \f$
* P_{-}(-r^s)\f$, where \f$ s \f$ is the size of the group to be interleaved.
*
* This method uses `padding_indicator_array`, whose i-th entry is FF{1} if i < log_n and 0 otherwise.
* We use these entries to either assign `eval_pos_prev` the value `eval_pos` computed in the current iteration
* of the loop, or to propagate the batched evaluation of the multilinear polynomials to the next iteration.
Expand All @@ -398,8 +318,7 @@ template <typename Curve> class GeminiVerifier_ {
const Fr& batched_evaluation,
std::span<const Fr> evaluation_point, // size = virtual_log_n
std::span<const Fr> challenge_powers, // size = virtual_log_n
std::span<const Fr> fold_neg_evals, // size = virtual_log_n
Fr p_neg = Fr(0))
std::span<const Fr> fold_neg_evals) // size = virtual_log_n
{
const size_t virtual_log_n = evaluation_point.size();

Expand All @@ -410,8 +329,6 @@ template <typename Curve> class GeminiVerifier_ {
std::vector<Fr> fold_pos_evaluations;
fold_pos_evaluations.reserve(virtual_log_n);

// Add the contribution of P-((-r)ˢ) to get A_0(-r), which is 0 if there are no interleaved polynomials
evals[0] += p_neg;
// Solve the sequence of linear equations
for (size_t l = virtual_log_n; l != 0; --l) {
// Get r²⁽ˡ⁻¹⁾
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,6 @@ std::vector<typename GeminiProver_<Curve>::Claim> GeminiProver_<Curve>::prove(
transcript->send_to_verifier(label, claims[l].opening_pair.evaluation);
}

// If running Gemini for the Translator VM polynomials, A₀(r) = A₀₊(r) + P₊(rˢ) and A₀(-r) = A₀₋(-r) + P₋(rˢ)
// where s is the size of the interleaved group assumed even. The prover sends P₊(rˢ) and P₋(rˢ) to the verifier
// so it can reconstruct the evaluation of A₀(r) and A₀(-r) respectively
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1282)
if (polynomial_batcher.has_interleaved()) {
auto [P_pos, P_neg] = polynomial_batcher.compute_partially_evaluated_interleaved_polynomial(r_challenge);
Fr r_pow = r_challenge.pow(polynomial_batcher.get_group_size());
Fr P_pos_eval = P_pos.evaluate(r_pow);
Fr P_neg_eval = P_neg.evaluate(r_pow);
claims.emplace_back(Claim{ std::move(P_pos), { r_pow, P_pos_eval } });
transcript->send_to_verifier("Gemini:P_pos", P_pos_eval);
claims.emplace_back(Claim{ std::move(P_neg), { r_pow, P_neg_eval } });
transcript->send_to_verifier("Gemini:P_neg", P_neg_eval);
}

return claims;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,7 @@ TEST_F(KZGTest, ShpleminiKzgWithShiftAndInterleaving)
/*num_polynomials*/ 4,
/*num_to_be_shifted*/ 2,
mle_opening_point,
ck,
/*num_interleaved*/ 3,
/*num_to_be_interleaved*/ 2);
ck);

auto prover_transcript = NativeTranscript::test_prover_init_empty();

Expand Down
Loading
Loading