Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey > Class Template Reference

Base Native verification key class. More...

#include <flavor.hpp>

Inheritance diagram for bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >:

Public Types

using Commitment = typename PrecomputedCommitments::DataType
 
using DataType = typename Codec::DataType
 

Public Member Functions

bool operator== (const NativeVerificationKey_ &) const =default
 
template<size_t NUM_PRECOMPUTED_ENTITIES, typename StringType >
bool compare (const NativeVerificationKey_ &other, RefArray< StringType, NUM_PRECOMPUTED_ENTITIES > commitment_labels) const
 
virtual ~NativeVerificationKey_ ()=default
 
 NativeVerificationKey_ ()=default
 
template<typename PrecomputedData >
requires (!std::is_void_v<CommitmentKey>)
 NativeVerificationKey_ (const PrecomputedData &precomputed)
 Construct VK from precomputed data by committing to polynomials.
 
virtual std::vector< DataTypeto_field_elements () const
 Serialize verification key to field elements.
 
size_t from_field_elements (const std::span< const DataType > &elements)
 Populate verification key from field elements.
 
fr hash () const
 Compute VK hash.
 
virtual DataType hash_with_origin_tagging (const OriginTag &tag) const
 Tag VK components and hash.
 
template<typename Transcript >
DataType hash_with_origin_tagging (const Transcript &transcript) const
 An overload that accepts a transcript and extracts the tag internally.
 

Static Public Member Functions

static size_t calc_num_data_types ()
 Calculate the number of field elements needed for serialization.
 

Public Attributes

uint64_t log_circuit_size = 0
 
uint64_t num_public_inputs = 0
 
uint64_t pub_inputs_offset = 0
 

Detailed Description

template<typename PrecomputedCommitments, typename Codec, typename HashFunction, typename CommitmentKey = void>
class bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >

Base Native verification key class.

We want a separate native and stdlib verification key class because we don't have nice mappings from native to stdlib and back. Examples of mappings that don't exist are from uint64_t to field_t, .get_value() doesn't have a native equivalent, and Builder also doesn't have a native equivalent.

Template Parameters
PrecomputedEntitiesAn instance of PrecomputedEntities_ with affine_element data type and handle type.
CodecThe codec used for serialization (e.g., FrCodec, U256Codec)
HashFunctionThe hash function used for VK hashing (e.g., Poseidon2, Keccak)

Definition at line 135 of file flavor.hpp.

Member Typedef Documentation

◆ Commitment

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
using bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::Commitment = typename PrecomputedCommitments::DataType

Definition at line 137 of file flavor.hpp.

◆ DataType

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
using bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::DataType = typename Codec::DataType

Definition at line 138 of file flavor.hpp.

Constructor & Destructor Documentation

◆ ~NativeVerificationKey_()

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
virtual bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::~NativeVerificationKey_ ( )
virtualdefault

◆ NativeVerificationKey_() [1/2]

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::NativeVerificationKey_ ( )
default

◆ NativeVerificationKey_() [2/2]

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
template<typename PrecomputedData >
requires (!std::is_void_v<CommitmentKey>)
bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::NativeVerificationKey_ ( const PrecomputedData &  precomputed)
inlineexplicit

Construct VK from precomputed data by committing to polynomials.

Only available when CommitmentKeyType is specified (not void)

Definition at line 185 of file flavor.hpp.

Member Function Documentation

◆ calc_num_data_types()

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
static size_t bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::calc_num_data_types ( )
inlinestatic

Calculate the number of field elements needed for serialization.

Returns
size_t Number of field elements

Definition at line 200 of file flavor.hpp.

◆ compare()

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
template<size_t NUM_PRECOMPUTED_ENTITIES, typename StringType >
bool bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::compare ( const NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey > &  other,
RefArray< StringType, NUM_PRECOMPUTED_ENTITIES >  commitment_labels 
) const
inline

Definition at line 146 of file flavor.hpp.

◆ from_field_elements()

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
size_t bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::from_field_elements ( const std::span< const DataType > &  elements)
inline

Populate verification key from field elements.

Parameters
elementsField elements to deserialize from

Definition at line 237 of file flavor.hpp.

◆ hash()

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
fr bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::hash ( ) const
inline

Compute VK hash.

Returns
FF

Definition at line 261 of file flavor.hpp.

◆ hash_with_origin_tagging() [1/2]

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
virtual DataType bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::hash_with_origin_tagging ( const OriginTag tag) const
inlinevirtual

Tag VK components and hash.

Needed to make sure the Origin Tag system works. We need to set the origin tags of the VK witnesses. If we instead did the hashing outside and just submitted the hash, only the origin tag of the hash would be set properly. By tagging the VK components directly, we ensure all VK witnesses have proper origin tags.

Parameters
tagThe origin tag extracted from the transcript
Returns
The hash of the verification key

Definition at line 276 of file flavor.hpp.

◆ hash_with_origin_tagging() [2/2]

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
template<typename Transcript >
DataType bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::hash_with_origin_tagging ( const Transcript transcript) const
inline

An overload that accepts a transcript and extracts the tag internally.

Template Parameters
TranscriptTypeThe transcript type (Codec and HashFunction deduced automatically)
Parameters
transcriptThe transcript to extract the origin tag from
Returns
The hash of the verification key

Definition at line 311 of file flavor.hpp.

◆ operator==()

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
bool bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::operator== ( const NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey > &  ) const
default

◆ to_field_elements()

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
virtual std::vector< DataType > bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::to_field_elements ( ) const
inlinevirtual

Serialize verification key to field elements.

Returns
std::vector<FF>

Definition at line 212 of file flavor.hpp.

Member Data Documentation

◆ log_circuit_size

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
uint64_t bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::log_circuit_size = 0

Definition at line 139 of file flavor.hpp.

◆ num_public_inputs

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
uint64_t bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::num_public_inputs = 0

Definition at line 140 of file flavor.hpp.

◆ pub_inputs_offset

template<typename PrecomputedCommitments , typename Codec , typename HashFunction , typename CommitmentKey = void>
uint64_t bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey >::pub_inputs_offset = 0

Definition at line 141 of file flavor.hpp.


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