Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
goblin_verifier.cpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Complete, auditors: [Sergei], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#include "goblin_verifier.hpp"
10
11namespace bb {
12
18template <typename Curve>
19typename GoblinVerifier_<Curve>::ReductionResult GoblinVerifier_<
20 Curve>::reduce_to_pairing_check_and_triple_ipa_opening()
21{
22 BB_BENCH_NAME("GoblinVerifier::reduce");
23 // Step 1: Verify the merge proof
24 MergeVerifier merge_verifier{ transcript };
25 auto merge_result = merge_verifier.reduce_to_pairing_check(proof.merge_proof, merge_commitments);
26 vinfo("Goblin: Merge reduced to pairing check successfully: ", merge_result.reduction_succeeded ? "true" : "false");
27
28 if constexpr (!IsRecursive) {
29 if (!merge_result.reduction_succeeded) {
30 info("Goblin verification failed at Merge step");
31 return ReductionResult();
32 }
33 if (!merge_result.pairing_points.check()) {
34 info("Goblin verification failed at Merge pairing check");
35 return ReductionResult();
36 }
37 }
38
39 // Step 2: Verify the ECCVM proof
40 ECCVMVerifier eccvm_verifier{ transcript, proof.eccvm_proof };
41 auto eccvm_result = eccvm_verifier.reduce_to_triple_ipa_claim();
42 vinfo("Goblin: ECCVM reduced to TripleIPA claim successfully: ",
43 eccvm_result.reduction_succeeded ? "true" : "false");
44
45 if constexpr (!IsRecursive) {
46 if (!eccvm_result.reduction_succeeded) {
47 info("Goblin verification failed at ECCVM step");
48 return ReductionResult();
49 }
50 }
51
52 // Get translation data from ECCVM verifier
53 auto translator_input = eccvm_verifier.get_translator_input_data();
54
55 // Step 3: Verify the Translator proof
56 // - Pass `merged_table_commitments` as op queue wire commitments to bind Translator and Merge to the same op_queue
57 // - `accumulated_result` and corresponding challenges ensure non-native computation matches ECCVM's native result
58 TranslatorVerifier translator_verifier{ transcript,
59 proof.translator_proof,
60 translator_input.evaluation_challenge_x,
61 translator_input.batching_challenge_v,
62 translator_input.accumulated_result,
63 merge_result.merged_commitments };
64 auto translator_result = translator_verifier.reduce_to_pairing_check();
65 vinfo("Goblin: Translator reduced to pairing check successfully: ",
66 translator_result.reduction_succeeded ? "true" : "false");
67
68 if constexpr (!IsRecursive) {
69 if (!translator_result.reduction_succeeded) {
70 info("Goblin verification failed at Translator step");
71 return ReductionResult();
72 }
73
74 if (!translator_result.pairing_points.check()) {
75 info("Goblin verification failed at Translator pairing check");
76 return ReductionResult();
77 }
78 }
79
80 // Combine all check results
81 // Recursive: must evaluate all booleans (circuit structure must be fixed)
82 // Native: redundant check (already returned early on failure), but kept for consistency
83 bool all_checks_passed =
84 merge_result.reduction_succeeded && eccvm_result.reduction_succeeded && translator_result.reduction_succeeded;
85
86 // Warning: `all_checks_passed` always excludes TripleIPA verification (deferred in both modes).
87 // Native mode: pairing checks already performed above (fail-fast), included in all_checks_passed
88 // Recursive mode: pairing checks deferred, excluded from all_checks_passed (for in-circuit batching)
89 // In recursive mode, boolean flags are for circuit structure only (not actual verification).
90 // Note: Pairing points are NOT aggregated here - caller should use aggregate_multiple for efficiency
91 ReductionResult result{ .merge_pairing_points = std::move(merge_result.pairing_points),
92 .translator_pairing_points = std::move(translator_result.pairing_points),
93 .triple_ipa_opening = { .claim = std::move(eccvm_result.triple_ipa_claim),
94 .proof = proof.ipa_proof },
95 .all_checks_passed = all_checks_passed };
96
97 return result;
98}
99
100// Explicit instantiations
101template class GoblinVerifier_<curve::BN254>;
103
104} // namespace bb
#define BB_BENCH_NAME(name)
Definition bb_bench.hpp:264
Unified ECCVM verifier class for both native and recursive verification.
ReductionResult reduce_to_triple_ipa_claim()
Reduce the ECCVM proof to a compact TripleIPA verifier claim.
Unified Goblin verifier for both native and recursive verification.
Verifier for the single-step Goblin ECC op queue merge protocol.
ReductionResult reduce_to_pairing_check(const Proof &proof, const InputCommitments &input_commitments)
Reduce the merge proof to a pairing check.
Translator verifier class that verifies the proof of the Translator circuit.
#define info(...)
Definition log.hpp:93
#define vinfo(...)
Definition log.hpp:94
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
VectorField result