Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ultra_verifier.cpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
14
15namespace bb {
16
22template <typename Flavor>
23template <class IO>
25 const typename UltraVerifier_<Flavor>::Proof& proof, const typename UltraVerifier_<Flavor>::Proof& ipa_proof)
26{
27 using FF = typename Flavor::FF;
28
29 transcript->load_proof(proof);
30 OinkVerifier<Flavor> oink_verifier{ verification_key, transcript };
31 oink_verifier.verify();
32
33 // Determine the number of rounds in the sumcheck based on whether or not padding is employed
34 const size_t log_n =
35 Flavor::USE_PADDING ? Flavor::VIRTUAL_LOG_N : static_cast<size_t>(verification_key->vk->log_circuit_size);
36 verification_key->target_sum = 0;
37 verification_key->gate_challenges =
38 transcript->template get_powers_of_challenge<FF>("Sumcheck:gate_challenge", log_n);
39
40 DeciderVerifier decider_verifier{ verification_key, transcript };
41 auto decider_output = decider_verifier.verify();
42
43 // Reconstruct the public inputs
44 IO inputs;
45 inputs.reconstruct_from_public(verification_key->public_inputs);
46
47 // Aggregate new pairing points with those reconstructed from the public inputs
48 decider_output.pairing_points.aggregate(inputs.pairing_inputs);
49
50 // Construrct the output
52 output.result = decider_output.check();
53
54 // Logging
55 if (!decider_output.sumcheck_verified) {
56 info("Sumcheck failed!");
57 }
58
59 if (!decider_output.libra_evals_verified) {
60 info("Libra evals failed!");
61 }
62
63 if constexpr (HasIPAAccumulator<Flavor>) {
64 // Reconstruct the nested IPA claim from the public inputs and run the native IPA verifier.
65 ipa_transcript->load_proof(ipa_proof);
66 bool ipa_result = IPA<curve::Grumpkin>::reduce_verify(ipa_verification_key, inputs.ipa_claim, ipa_transcript);
67
68 // Logging
69 if (!ipa_result) {
70 info("IPA verification failed!");
71 }
72
73 // Update output
74 output.result &= ipa_result;
75 } else if constexpr (std::is_same_v<IO, HidingKernelIO>) {
76 // Add ecc op tables if we are verifying a ClientIVC proof
77 output.ecc_op_tables = inputs.ecc_op_tables;
78 }
79
80 return output;
81}
82
83template class UltraVerifier_<UltraFlavor>;
86#ifdef STARKNET_GARAGA_FLAVORS
89#endif
92template class UltraVerifier_<MegaFlavor>;
93template class UltraVerifier_<MegaZKFlavor>;
94
96 const Proof& proof, const Proof& ipa_proof);
97
99 const Proof& proof, const Proof& ipa_proof);
100
102 DefaultIO>(const Proof& proof, const Proof& ipa_proof);
103
104#ifdef STARKNET_GARAGA_FLAVORS
106 DefaultIO>(const Proof& proof, const Proof& ipa_proof);
107
109 DefaultIO>(const Proof& proof, const Proof& ipa_proof);
110#endif
111
113 DefaultIO>(const Proof& proof, const Proof& ipa_proof);
114
116 RollupIO>(const Proof& proof, const Proof& ipa_proof);
117
119 const Proof& proof, const Proof& ipa_proof);
120
122 const Proof& proof, const Proof& ipa_proof);
123
124// ClientIVC specialization
126 const Proof& proof, const Proof& ipa_proof);
127
128} // namespace bb
Output verify()
Verify a decider proof that is assumed to be contained in the transcript.
Manages the data that is propagated on the public inputs of an application/function circuit.
IPA (inner product argument) commitment scheme class.
Definition ipa.hpp:95
Curve::ScalarField FF
static constexpr size_t VIRTUAL_LOG_N
static constexpr bool USE_PADDING
Verifier class for all the presumcheck rounds, which are shared between the folding verifier and ultr...
void verify()
Oink Verifier function that runs all the rounds of the verifier.
void aggregate(const PairingPoints &other)
Aggregate the current pairing points with another set of pairing points using a random scalar.
The data that is propagated on the public inputs of a rollup circuit.
typename Transcript::Proof Proof
typename Flavor::FF FF
UltraVerifierOutput verify_proof(const Proof &proof, const Proof &ipa_proof={})
void info(Args... args)
Definition log.hpp:70
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::array< Commitment, Flavor::NUM_WIRES > ecc_op_tables