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>
20{
21 BB_BENCH_NAME("GoblinVerifier::reduce");
22 // Step 1: Verify the merge proof
23 MergeVerifier merge_verifier{ merge_settings, transcript };
24 auto merge_result = merge_verifier.reduce_to_pairing_check(proof.merge_proof, merge_commitments);
25 vinfo("Goblin: Merge reduced to pairing check successfully: ", merge_result.reduction_succeeded ? "true" : "false");
26
27 if constexpr (!IsRecursive) {
28 if (!merge_result.reduction_succeeded) {
29 info("Goblin verification failed at Merge step");
30 return ReductionResult();
31 }
32 if (!merge_result.pairing_points.check()) {
33 info("Goblin verification failed at Merge pairing check");
34 return ReductionResult();
35 }
36 }
37
38 // Step 2: Verify the ECCVM proof
39 ECCVMVerifier eccvm_verifier{ transcript, proof.eccvm_proof };
40 auto eccvm_result = eccvm_verifier.reduce_to_ipa_opening();
41 vinfo("Goblin: ECCVM reduced to IPA opening successfully: ", eccvm_result.reduction_succeeded ? "true" : "false");
42
43 if constexpr (!IsRecursive) {
44 if (!eccvm_result.reduction_succeeded) {
45 info("Goblin verification failed at ECCVM step");
46 return ReductionResult();
47 }
48 }
49
50 // Get translation data from ECCVM verifier
51 auto translator_input = eccvm_verifier.get_translator_input_data();
52
53 // Step 3: Verify the Translator proof
54 // - Pass `merged_table_commitments` as op queue wire commitments to bind Translator and Merge to the same op_queue
55 // - `accumulated_result` and corresponding challenges ensure non-native computation matches ECCVM's native result
56 TranslatorVerifier translator_verifier{ transcript,
57 proof.translator_proof,
58 translator_input.evaluation_challenge_x,
59 translator_input.batching_challenge_v,
60 translator_input.accumulated_result,
61 merge_result.merged_commitments };
62 auto translator_result = translator_verifier.reduce_to_pairing_check();
63 vinfo("Goblin: Translator reduced to pairing check successfully: ",
64 translator_result.reduction_succeeded ? "true" : "false");
65
66 if constexpr (!IsRecursive) {
67 if (!translator_result.reduction_succeeded) {
68 info("Goblin verification failed at Translator step");
69 return ReductionResult();
70 }
71
72 if (!translator_result.pairing_points.check()) {
73 info("Goblin verification failed at Translator pairing check");
74 return ReductionResult();
75 }
76 }
77
78 // Combine all check results
79 // Recursive: must evaluate all booleans (circuit structure must be fixed)
80 // Native: redundant check (already returned early on failure), but kept for consistency
81 bool all_checks_passed =
82 merge_result.reduction_succeeded && eccvm_result.reduction_succeeded && translator_result.reduction_succeeded;
83
84 // Warning: `all_checks_passed` always excludes IPA verification (deferred in both modes).
85 // Native mode: pairing checks already performed above (fail-fast), included in all_checks_passed
86 // Recursive mode: pairing checks deferred, excluded from all_checks_passed (for in-circuit batching)
87 // In recursive mode, boolean flags are for circuit structure only (not actual verification).
88 // Note: Pairing points are NOT aggregated here - caller should use aggregate_multiple for efficiency
89 ReductionResult result{ .merge_pairing_points = std::move(merge_result.pairing_points),
90 .translator_pairing_points = std::move(translator_result.pairing_points),
91 .ipa_claim = std::move(eccvm_result.ipa_claim),
92 .ipa_proof = proof.ipa_proof,
93 .all_checks_passed = all_checks_passed };
94
95 return result;
96}
97
98// Explicit instantiations
101
102} // namespace bb
#define BB_BENCH_NAME(name)
Definition bb_bench.hpp:225
Unified ECCVM verifier class for both native and recursive verification.
ReductionResult reduce_to_ipa_opening()
Reduce the ECCVM proof to an IPA opening claim.
Unified Goblin verifier for both native and recursive verification.
ReductionResult reduce_to_pairing_check_and_ipa_opening()
Reduce Goblin proof to pairing check and IPA opening claim.
Unified verifier class for the Goblin ECC op queue transcript 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
Result of Goblin verification with mode-specific semantics.