Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
proof.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Completed, auditors: [Sergei], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
8
11#include <cstdint>
12
13namespace bb::stdlib {
14
20template <typename Builder> class Proof : public std::vector<bb::stdlib::field_t<Builder>> {
21 public:
23 using Base::Base; // Inherit all constructors from std::vector
24
25 // Explicitly define vector copy constructor (not inherited by default)
26 Proof(const std::vector<bb::stdlib::field_t<Builder>>& fields)
27 : Base(fields)
28 {}
29
30 // Constructor from a native Proof
31 Proof(Builder& builder, const HonkProof& native_proof)
32 {
33 this->reserve(native_proof.size());
34 for (const auto& element : native_proof) {
36 }
37 };
38
39 // Extract the circuit builder context shared by the proof's witnesses.
40 // Recursive verifiers recover their builder from the proof elements; validate_context checks that every
41 // element belongs to the same builder and returns it (nullptr if the proof is empty or all-constant), so
42 // we reject that case rather than dereferencing past the end of an empty proof.
44 {
45 Builder* context = validate_context<Builder>(*this);
46 if (context == nullptr) {
47 throw_or_abort("stdlib::Proof::get_context: cannot extract builder from an empty or constant proof");
48 }
49 return context;
50 }
51
52 // Extract the native HonkProof
54 {
56 result.reserve(this->size());
57 for (const auto& element : *this) {
58 result.push_back(element.get_value());
59 }
60 return result;
61 };
62};
63
64} // namespace bb::stdlib
A simple wrapper around a vector of stdlib field elements representing a proof.
Definition proof.hpp:20
Proof(const std::vector< bb::stdlib::field_t< Builder > > &fields)
Definition proof.hpp:26
Builder * get_context() const
Definition proof.hpp:43
HonkProof get_value() const
Definition proof.hpp:53
std::vector< bb::stdlib::field_t< Builder > > Base
Definition proof.hpp:22
Proof(Builder &builder, const HonkProof &native_proof)
Definition proof.hpp:31
AluTraceBuilder builder
Definition alu.test.cpp:124
StrictMock< MockContext > context
std::conditional_t< IsGoblinBigGroup< C, Fq, Fr, G >, element_goblin::goblin_element< C, goblin_field< C >, Fr, G >, element_default::element< C, Fq, Fr, G > > element
element wraps either element_default::element or element_goblin::goblin_element depending on parametr...
std::vector< fr > HonkProof
Definition proof.hpp:15
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
void throw_or_abort(std::string const &err)
VectorField result