Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
triple_ipa_claim.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
8
13
14#include <cstddef>
15#include <span>
16#include <vector>
17
18namespace bb {
19
40
48template <typename Curve> struct TripleIpaClaimData {
49 using Fr = typename Curve::ScalarField;
51
53 std::vector<Commitment> commitments;
54 std::vector<Fr> evaluations;
55 std::vector<Fr> rho_powers;
56 std::vector<Fr> multilinear_challenge;
57 };
58
59 struct ShiftedBatch {
60 std::vector<Commitment> commitments; // source commitments (the flavor's get_to_be_shifted set)
61 std::vector<Fr> source_unshifted_evaluations; // sources' unshifted evals at u; used for the <F',eq> cross-sum
62 std::vector<Fr> shifted_evaluations; // the shifted evals at u (the diagonal shift claim)
63 std::vector<Fr> rho_powers;
64 };
65
69
71 static std::vector<Fr> rho_powers(const Fr& rho, size_t count, size_t offset = 0)
72 {
73 std::vector<Fr> powers;
74 powers.reserve(count);
75 Fr power = Fr::one();
76 for (size_t idx = 0; idx < offset; ++idx) {
77 power *= rho;
78 }
79 for (size_t idx = 0; idx < count; ++idx) {
80 powers.emplace_back(power);
81 power *= rho;
82 }
83 return powers;
84 }
85
93 template <typename CommitmentRange,
94 typename EvaluationRange,
95 typename ShiftedCommitmentRange,
96 typename ShiftedSourceEvaluationRange,
97 typename ShiftedEvaluationRange>
98 static TripleIpaClaimData create(const CommitmentRange& unshifted_commitments,
99 const EvaluationRange& unshifted_evaluations,
100 const ShiftedCommitmentRange& shifted_source_commitments,
101 const ShiftedSourceEvaluationRange& shifted_source_evaluations,
102 const ShiftedEvaluationRange& shifted_evaluations,
103 std::span<const Fr> multilinear_challenge,
104 const Fr& rho,
106 {
107 const size_t num_unshifted = unshifted_commitments.size();
108 BB_ASSERT_EQ(num_unshifted, unshifted_evaluations.size());
109 const size_t num_shifted = shifted_evaluations.size();
110 BB_ASSERT_EQ(num_shifted, shifted_source_commitments.size());
111 BB_ASSERT_EQ(num_shifted, shifted_source_evaluations.size());
112
114 data.unshifted.multilinear_challenge.assign(multilinear_challenge.begin(), multilinear_challenge.end());
115 data.unshifted.commitments.reserve(num_unshifted);
116 data.unshifted.evaluations.reserve(num_unshifted);
117 for (size_t idx = 0; idx < num_unshifted; ++idx) {
118 data.unshifted.commitments.emplace_back(unshifted_commitments[idx]);
119 data.unshifted.evaluations.emplace_back(unshifted_evaluations[idx]);
120 }
121 data.unshifted.rho_powers = rho_powers(rho, num_unshifted);
122
123 data.shifted.commitments.reserve(num_shifted);
124 data.shifted.source_unshifted_evaluations.reserve(num_shifted);
125 data.shifted.shifted_evaluations.reserve(num_shifted);
126 for (size_t idx = 0; idx < num_shifted; ++idx) {
127 data.shifted.commitments.emplace_back(shifted_source_commitments[idx]);
128 data.shifted.source_unshifted_evaluations.emplace_back(shifted_source_evaluations[idx]);
129 data.shifted.shifted_evaluations.emplace_back(shifted_evaluations[idx]);
130 }
131 data.shifted.rho_powers = rho_powers(rho, num_shifted, num_unshifted);
132
133 data.univariate = univariate;
134 return data;
135 }
136
155};
156
167
168} // namespace bb
#define BB_ASSERT_EQ(actual, expected,...)
Definition assert.hpp:83
Unverified claim (C,r,v) for some witness polynomial p(X) such that.
Definition claim.hpp:55
typename Group::affine_element AffineElement
Definition grumpkin.hpp:64
ssize_t offset
Definition engine.cpp:62
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::byte * data
std::vector< Commitment > commitments
Pre-batch verifier-side claim data: per-polynomial commitments/evaluations before Stage-1 rho-batchin...
typename Curve::AffineElement Commitment
OpeningClaim< Curve > univariate
static TripleIpaClaimData create(const CommitmentRange &unshifted_commitments, const EvaluationRange &unshifted_evaluations, const ShiftedCommitmentRange &shifted_source_commitments, const ShiftedSourceEvaluationRange &shifted_source_evaluations, const ShiftedEvaluationRange &shifted_evaluations, std::span< const Fr > multilinear_challenge, const Fr &rho, const OpeningClaim< Curve > &univariate)
Build the claim data shared by the ECCVM prover and verifier.
static std::vector< Fr > rho_powers(const Fr &rho, size_t count, size_t offset=0)
Consecutive powers rho^offset, ..., rho^{offset + count - 1}.
typename Curve::ScalarField Fr
TripleIpaClaim< Curve > batch() const
Stage-1 rho-batching: collapse the per-polynomial data into the compact three-claim statement.
The compact TripleIPA opening claim: the statement that crosses verifier boundaries.
typename Curve::ScalarField Fr
std::vector< Fr > multilinear_challenge
Commitment unshifted_commitment
OpeningClaim< Curve > univariate
typename Curve::AffineElement Commitment
Prover-side TripleIPA input: claim data plus the witness polynomials needed to build the proof.
std::vector< Polynomial > shifted_polynomials
std::vector< Polynomial > unshifted_polynomials
typename Curve::ScalarField Fr
TripleIpaClaimData< Curve > claim_data
static constexpr field one()
static constexpr field zero()