Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::VKAndHash_< FF, VerificationKey > Class Template Reference

Wrapper holding a verification key and its precomputed hash. More...

#include <flavor.hpp>

Public Types

template<typename T = VerificationKey>
using Builder = typename std::enable_if_t< requires { typename T::Builder
 
template<typename T = VerificationKey>
using NativeVerificationKey = typename std::enable_if_t< requires { typename T::NativeVerificationKey
 

Public Member Functions

 VKAndHash_ ()=default
 
 VKAndHash_ (const std::shared_ptr< VerificationKey > &vk)
 Construct from VK, auto-computing the hash.
 
 VKAndHash_ (const std::shared_ptr< VerificationKey > &vk, const FF &hash)
 Construct from VK and pre-provided hash.
 
template<typename VK = VerificationKey, typename B = typename VK::Builder, typename NVK = typename VK::NativeVerificationKey>
 VKAndHash_ (B &builder, const std::shared_ptr< NVK > &native_vk)
 Construct stdlib VKAndHash from a native VK (recursive verification keys only).
 

Public Attributes

std::shared_ptr< VerificationKeyvk
 
FF hash
 

Detailed Description

template<typename FF, typename VerificationKey>
class bb::VKAndHash_< FF, VerificationKey >

Wrapper holding a verification key and its precomputed hash.

The hash is used to bind the verification key to the proof during verification, ensuring that the correct VK is used.

This class provides three constructors for different use cases:

  1. VKAndHash_(vk) - Auto-computes hash from VK
    • Use case: Native verification entry points (e.g., bb verify, ACIR proof verification)
  2. VKAndHash_(builder, native_vk) - Creates stdlib VK from native and computes hash (recursive only)
    • Use case: Setting up recursive verifiers with a native VK reference
  3. VKAndHash_(vk, hash) - Takes both VK and hash separately
    • Use case: Constraint-based recursion (ACIR) where hash is provided as a separate circuit witness
Template Parameters
FFThe field type (native fr or stdlib field_t)
VerificationKeyThe verification key type (native or stdlib)

Definition at line 521 of file flavor.hpp.

Member Typedef Documentation

◆ Builder

template<typename FF , typename VerificationKey >
template<typename T = VerificationKey>
using bb::VKAndHash_< FF, VerificationKey >::Builder = typename std::enable_if_t<requires { typename T::Builder

Definition at line 524 of file flavor.hpp.

◆ NativeVerificationKey

template<typename FF , typename VerificationKey >
template<typename T = VerificationKey>
using bb::VKAndHash_< FF, VerificationKey >::NativeVerificationKey = typename std::enable_if_t<requires { typename T::NativeVerificationKey

Definition at line 527 of file flavor.hpp.

Constructor & Destructor Documentation

◆ VKAndHash_() [1/4]

template<typename FF , typename VerificationKey >
bb::VKAndHash_< FF, VerificationKey >::VKAndHash_ ( )
default

◆ VKAndHash_() [2/4]

template<typename FF , typename VerificationKey >
bb::VKAndHash_< FF, VerificationKey >::VKAndHash_ ( const std::shared_ptr< VerificationKey > &  vk)
inline

Construct from VK, auto-computing the hash.

Definition at line 535 of file flavor.hpp.

◆ VKAndHash_() [3/4]

template<typename FF , typename VerificationKey >
bb::VKAndHash_< FF, VerificationKey >::VKAndHash_ ( const std::shared_ptr< VerificationKey > &  vk,
const FF hash 
)
inline

Construct from VK and pre-provided hash.

Definition at line 543 of file flavor.hpp.

◆ VKAndHash_() [4/4]

template<typename FF , typename VerificationKey >
template<typename VK = VerificationKey, typename B = typename VK::Builder, typename NVK = typename VK::NativeVerificationKey>
bb::VKAndHash_< FF, VerificationKey >::VKAndHash_ ( B &  builder,
const std::shared_ptr< NVK > &  native_vk 
)
inline

Construct stdlib VKAndHash from a native VK (recursive verification keys only).

Definition at line 554 of file flavor.hpp.

Member Data Documentation

◆ hash

template<typename FF , typename VerificationKey >
FF bb::VKAndHash_< FF, VerificationKey >::hash

Definition at line 559 of file flavor.hpp.

◆ vk

template<typename FF , typename VerificationKey >
std::shared_ptr<VerificationKey> bb::VKAndHash_< FF, VerificationKey >::vk

Definition at line 558 of file flavor.hpp.


The documentation for this class was generated from the following file: