Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
client_ivc_recursive_verifier.hpp
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
7#pragma once
11
14 using Builder = UltraCircuitBuilder; // The circuit will be an Ultra circuit
15 using RecursiveFlavor = MegaZKRecursiveFlavor_<Builder>; // The hiding circuit verifier algorithm is MegaZK
25
26 public:
31
32 struct StdlibProof {
35
36 static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS(size_t virtual_log_n = Flavor::VIRTUAL_LOG_N)
37 {
39 }
40
41 static constexpr size_t PROOF_LENGTH(size_t virtual_log_n = Flavor::VIRTUAL_LOG_N)
42 {
43 return bb::ClientIVC::Proof::PROOF_LENGTH(virtual_log_n);
44 }
45
46 StdlibHonkProof mega_proof; // proof of the hiding circuit
48
53
60 StdlibProof(const std::vector<field_t<Builder>>& proof_indices, size_t virtual_log_n = Flavor::VIRTUAL_LOG_N)
61 {
62
63 BB_ASSERT_EQ(proof_indices.size(),
64 PROOF_LENGTH(virtual_log_n),
65 "Number of indices differs from the expected proof size.");
66
67 auto it = proof_indices.begin();
68
69 // Mega proof
70 std::ptrdiff_t start_idx = 0;
71 std::ptrdiff_t end_idx = static_cast<std::ptrdiff_t>(
72 RecursiveFlavor::NativeFlavor::PROOF_LENGTH_WITHOUT_PUB_INPUTS(virtual_log_n) +
74 mega_proof.insert(mega_proof.end(), it + start_idx, it + end_idx);
75
76 // Merge proof
77 start_idx = end_idx;
78 end_idx += static_cast<std::ptrdiff_t>(MERGE_PROOF_SIZE);
79 goblin_proof.merge_proof.insert(goblin_proof.merge_proof.end(), it + start_idx, it + end_idx);
80
81 // ECCVM pre-ipa proof
82 start_idx = end_idx;
83 end_idx += static_cast<std::ptrdiff_t>(ECCVMFlavor::PROOF_LENGTH_WITHOUT_PUB_INPUTS - IPA_PROOF_LENGTH);
85 goblin_proof.eccvm_proof.pre_ipa_proof.end(), it + start_idx, it + end_idx);
86
87 // ECCVM ipa proof
88 start_idx = end_idx;
89 end_idx += static_cast<std::ptrdiff_t>(IPA_PROOF_LENGTH);
91 goblin_proof.eccvm_proof.ipa_proof.end(), it + start_idx, it + end_idx);
92
93 // Translator proof
94 start_idx = end_idx;
96 goblin_proof.translator_proof.insert(goblin_proof.translator_proof.end(), it + start_idx, it + end_idx);
97
98 BB_ASSERT_EQ(static_cast<uint32_t>(end_idx),
99 PROOF_LENGTH(virtual_log_n),
100 "Reconstructed a ClientIVC proof of wrong the length from proof indices.");
101 }
102 };
103
104 ClientIVCRecursiveVerifier(Builder* builder, const std::shared_ptr<VerificationKey>& native_mega_vk)
106 , stdlib_mega_vk_and_hash(std::make_shared<RecursiveVKAndHash>(*builder, native_mega_vk)) {};
107
111
112 [[nodiscard("IPA claim and Pairing points should be accumulated")]] Output verify(const StdlibProof&);
113
114 private:
116 // VK and hash of the hiding kernel
117 std::shared_ptr<RecursiveVKAndHash> stdlib_mega_vk_and_hash;
118};
119} // namespace bb::stdlib::recursion::honk
#define BB_ASSERT_EQ(actual, expected,...)
Definition assert.hpp:59
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS
The verification key is responsible for storing the commitments to the precomputed (non-witness) poly...
static constexpr size_t VIRTUAL_LOG_N
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
Child class of MegaFlavor that runs with ZK Sumcheck. See more in Sumcheck Outline.
The recursive counterpart to the "native" MegaZKFlavor.
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS
A simple wrapper around a vector of stdlib field elements representing a proof.
Definition proof.hpp:19
ClientIVCRecursiveVerifier(Builder *builder, const std::shared_ptr< RecursiveVKAndHash > &stdlib_mega_vk_and_hash)
RecursiveDeciderVerificationKeys::VerificationKey RecursiveVerificationKey
Output verify(const StdlibProof &)
Creates a circuit that executes the ClientIvc verification algorithm.
ClientIVCRecursiveVerifier(Builder *builder, const std::shared_ptr< VerificationKey > &native_mega_vk)
bb::BaseTranscript< bb::stdlib::recursion::honk::StdlibTranscriptParams< Builder > > Transcript
Manages the data that is propagated on the public inputs of a hiding kernel circuit.
The stdlib counterpart of DeciderVerificationKey, used in recursive folding verification.
UltraCircuitBuilder_< UltraExecutionTraceBlocks > UltraCircuitBuilder
STL namespace.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
A full proof for the IVC scheme containing a Mega proof showing correctness of the hiding circuit (wh...
static constexpr size_t PROOF_LENGTH(size_t virtual_log_n=MegaZKFlavor::VIRTUAL_LOG_N)
The size of a ClientIVC proof with backend-added public inputs: HidingKernelIO.
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS(size_t virtual_log_n=MegaZKFlavor::VIRTUAL_LOG_N)
The size of a ClientIVC proof without backend-added public inputs.
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS(size_t virtual_log_n=Flavor::VIRTUAL_LOG_N)
StdlibProof(const std::vector< field_t< Builder > > &proof_indices, size_t virtual_log_n=Flavor::VIRTUAL_LOG_N)
Construct a new Stdlib Proof object from indices in a builder.
static constexpr size_t PROOF_LENGTH(size_t virtual_log_n=Flavor::VIRTUAL_LOG_N)