Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
merge_verifier.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Complete, auditors: [Sergei], commit: d1307bdee7f2ee0e737c19b77a26204a8dbafafc}
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
8
15
16namespace bb {
17
23template <typename Curve> class MergeVerifier_ {
24 public:
25 using FF = typename Curve::ScalarField;
27 using GroupElement = typename Curve::Element;
31 using Proof = std::vector<FF>; // Native: std::vector<bb::fr>, Recursive: stdlib::Proof<Builder>
33
34 // Number of columns that jointly constitute the op_queue, should be the same as the number of wires in the
35 // MegaCircuitBuilder
37 static constexpr bool IsRecursive = Curve::is_stdlib_type;
38
39 // Size of batch opening claim: [Q], [L₁..L₄], [R₁..R₄], [M₁..M₄], [G], [1]
40 static constexpr size_t MERGE_BATCHED_CLAIM_SIZE = (3 * NUM_WIRES) + 3;
41
42 using TableCommitments = std::array<Commitment, NUM_WIRES>; // Commitments to the subtables and the merged table
43
54
63 bool reduction_succeeded = false; // Aggregate of degree and concatenation checks
64 };
65
67 std::shared_ptr<Transcript> transcript;
68
74
92 [[nodiscard("Verification result should be checked")]] ReductionResult reduce_to_pairing_check(
93 const Proof& proof, const InputCommitments& input_commitments);
94
95 private:
96 std::vector<std::string> labels_degree_check = { "LEFT_TABLE_DEGREE_CHECK_0",
97 "LEFT_TABLE_DEGREE_CHECK_1",
98 "LEFT_TABLE_DEGREE_CHECK_2",
99 "LEFT_TABLE_DEGREE_CHECK_3" };
100
101 std::vector<std::string> labels_shplonk_batching_challenges = {
102 "SHPLONK_MERGE_BATCHING_CHALLENGE_0", "SHPLONK_MERGE_BATCHING_CHALLENGE_1",
103 "SHPLONK_MERGE_BATCHING_CHALLENGE_2", "SHPLONK_MERGE_BATCHING_CHALLENGE_3",
104 "SHPLONK_MERGE_BATCHING_CHALLENGE_4", "SHPLONK_MERGE_BATCHING_CHALLENGE_5",
105 "SHPLONK_MERGE_BATCHING_CHALLENGE_6", "SHPLONK_MERGE_BATCHING_CHALLENGE_7",
106 "SHPLONK_MERGE_BATCHING_CHALLENGE_8", "SHPLONK_MERGE_BATCHING_CHALLENGE_9",
107 "SHPLONK_MERGE_BATCHING_CHALLENGE_10", "SHPLONK_MERGE_BATCHING_CHALLENGE_11",
108 "SHPLONK_MERGE_BATCHING_CHALLENGE_12"
109 };
110
111 bool check_concatenation_identities(std::vector<FF>& evals, const FF& pow_kappa) const;
112
113 bool check_degree_identity(std::vector<FF>& evals,
114 const FF& pow_kappa_minus_one,
115 const std::vector<FF>& degree_check_challenges) const;
116
117 BatchOpeningClaim<Curve> compute_shplonk_opening_claim(const std::vector<Commitment>& table_commitments,
118 const Commitment& shplonk_batched_quotient,
119 const FF& shplonk_opening_challenge,
120 const std::vector<FF>& shplonk_batching_challenges,
121 const FF& kappa,
122 const FF& kappa_inv,
123 const std::vector<FF>& evals) const;
124};
125
126// Type aliases for convenience
128
129namespace stdlib::recursion::goblin {
130template <typename Builder> using MergeRecursiveVerifier = MergeVerifier_<bn254<Builder>>;
131} // namespace stdlib::recursion::goblin
132
133} // namespace bb
Unified verifier class for the Goblin ECC op queue transcript merge protocol.
static constexpr bool IsRecursive
typename Curve::AffineElement Commitment
typename Curve::ScalarField FF
std::shared_ptr< Transcript > transcript
typename Curve::Element GroupElement
BatchOpeningClaim< Curve > compute_shplonk_opening_claim(const std::vector< Commitment > &table_commitments, const Commitment &shplonk_batched_quotient, const FF &shplonk_opening_challenge, const std::vector< FF > &shplonk_batching_challenges, const FF &kappa, const FF &kappa_inv, const std::vector< FF > &evals) const
std::vector< FF > Proof
TranscriptFor_t< Curve > Transcript
MergeVerifier_(const MergeSettings settings=MergeSettings::PREPEND, std::shared_ptr< Transcript > transcript=std::make_shared< Transcript >())
bool check_concatenation_identities(std::vector< FF > &evals, const FF &pow_kappa) const
std::conditional_t< Curve::is_stdlib_type, stdlib::recursion::PairingPoints< Curve >, bb::PairingPoints< Curve > > PairingPoints
std::vector< std::string > labels_degree_check
static constexpr size_t MERGE_BATCHED_CLAIM_SIZE
bool check_degree_identity(std::vector< FF > &evals, const FF &pow_kappa_minus_one, const std::vector< FF > &degree_check_challenges) const
ReductionResult reduce_to_pairing_check(const Proof &proof, const InputCommitments &input_commitments)
Reduce the merge proof to a pairing check.
std::vector< std::string > labels_shplonk_batching_challenges
std::array< Commitment, NUM_WIRES > TableCommitments
static constexpr size_t NUM_WIRES
MergeSettings settings
An object storing two EC points that represent the inputs to a pairing check.
typename Group::element Element
Definition grumpkin.hpp:62
static constexpr bool is_stdlib_type
Definition grumpkin.hpp:69
typename Group::affine_element AffineElement
Definition grumpkin.hpp:63
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
MergeSettings
The MergeSettings define whether an current subtable will be added at the beginning (PREPEND) or at t...
typename TranscriptFor< Curve >::type TranscriptFor_t
STL namespace.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
An accumulator consisting of the Shplonk evaluation challenge and vectors of commitments and scalars.
Definition claim.hpp:151
Result of merge verification.