|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Base Native verification key class. More...
#include <flavor.hpp>
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 | |
| NativeVerificationKey_ (const size_t circuit_size, const size_t num_public_inputs) | |
| 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< DataType > | to_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 |
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.
| PrecomputedEntities | An instance of PrecomputedEntities_ with affine_element data type and handle type. |
| Codec | The codec used for serialization (e.g., FrCodec, U256Codec) |
| HashFunction | The hash function used for VK hashing (e.g., Poseidon2, Keccak) |
Definition at line 141 of file flavor.hpp.
| using bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey, SerializeMetadata >::Commitment = typename PrecomputedCommitments::DataType |
Definition at line 143 of file flavor.hpp.
| using bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey, SerializeMetadata >::DataType = typename Codec::DataType |
Definition at line 144 of file flavor.hpp.
|
virtualdefault |
|
default |
|
inline |
Definition at line 184 of file flavor.hpp.
|
inlineexplicit |
Construct VK from precomputed data by committing to polynomials.
Only available when CommitmentKeyType is specified (not void)
Definition at line 194 of file flavor.hpp.
|
inlinestatic |
Calculate the number of field elements needed for serialization.
Definition at line 209 of file flavor.hpp.
|
inline |
Definition at line 152 of file flavor.hpp.
|
inline |
Populate verification key from field elements.
| elements | Field elements to deserialize from |
Definition at line 257 of file flavor.hpp.
|
inline |
|
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.
| domain_separator | (currently unused, kept for API compatibility) |
| tag | The origin tag extracted from the transcript |
Reimplemented in bb::ECCVMFlavor::VerificationKey, bb::TranslatorFlavor::VerificationKey, and bb::avm2::AvmFlavor::VerificationKey.
Definition at line 300 of file flavor.hpp.
|
inline |
An overload that accepts a transcript and extracts the tag internally.
| TranscriptType | The transcript type (Codec and HashFunction deduced automatically) |
| transcript | The transcript to extract the origin tag from |
Definition at line 334 of file flavor.hpp.
|
default |
|
inlinevirtual |
Serialize verification key to field elements.
Definition at line 227 of file flavor.hpp.
| uint64_t bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey, SerializeMetadata >::log_circuit_size = 0 |
Definition at line 145 of file flavor.hpp.
| uint64_t bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey, SerializeMetadata >::num_public_inputs = 0 |
Definition at line 146 of file flavor.hpp.
| uint64_t bb::NativeVerificationKey_< PrecomputedCommitments, Codec, HashFunction, CommitmentKey, SerializeMetadata >::pub_inputs_offset = 0 |
Definition at line 147 of file flavor.hpp.