Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
stdlib_verification_key.test.cpp
Go to the documentation of this file.
12
13#include <gtest/gtest.h>
14
15using namespace bb;
16
17template <typename Flavor> class StdlibVerificationKeyTests : public ::testing::Test {
18 public:
19 using NativeFlavor = typename Flavor::NativeFlavor;
20
21 protected:
23};
24
25using FlavorTypes = testing::Types<UltraRecursiveFlavor_<UltraCircuitBuilder>,
32
38{
39 using Flavor = TypeParam;
40 using NativeFlavor = typename Flavor::NativeFlavor;
41 using NativeVerificationKey = typename NativeFlavor::VerificationKey;
42 using StdlibTranscript = typename Flavor::Transcript;
43 using StdlibVerificationKey = typename Flavor::VerificationKey;
44 using OuterBuilder = typename Flavor::CircuitBuilder;
46
47 // Create random circuit to create a vk.
49 if constexpr (IsAnyOf<Flavor, TranslatorRecursiveFlavor, ECCVMRecursiveFlavor>) {
51 } else {
53 using InnerBuilder = typename NativeFlavor::CircuitBuilder;
54
55 InnerBuilder builder;
56 if constexpr (HasIPAAccumulator<NativeFlavor>) {
58 } else {
60 }
61 auto prover_instance = std::make_shared<ProverInstance>(builder);
62 native_vk = std::make_shared<NativeVerificationKey>(prover_instance->get_precomputed());
63 }
64
65 OuterBuilder outer_builder;
66 StdlibVerificationKey vk(&outer_builder, native_vk);
67
68 // First method of hashing: using hash().
69 FF vk_hash_1 = vk.hash();
70
71 // Second method of hashing: using hash_with_origin_tagging.
72 // (ECCVM and Translator recursive flavors don't support hash_with_origin_tagging as their VKs are hardcoded)
73 if constexpr (!IsAnyOf<Flavor, TranslatorRecursiveFlavor, ECCVMRecursiveFlavor>) {
74 StdlibTranscript transcript;
75 FF vk_hash_2 = vk.hash_with_origin_tagging("", transcript);
76 EXPECT_EQ(vk_hash_1.get_value(), vk_hash_2.get_value());
77 }
78}
typename Flavor::NativeFlavor NativeFlavor
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
ECCVMCircuitBuilder CircuitBuilder
NativeTranscript Transcript
The recursive counterpart to the "native" Mega flavor.
A ProverInstance is normally constructed from a finalized circuit and it contains all the information...
The recursive counterpart of the native Translator flavor.
The recursive counterpart to the "native" Ultra flavor.
The recursive counterpart to the "native" UltraRollupFlavor.
static void add_default(Builder &builder)
Add default public inputs when they are not present.
static void add_default(Builder &builder)
Add default public inputs when they are not present.
AluTraceBuilder builder
Definition alu.test.cpp:124
testing::Types< MegaFlavor, UltraFlavor, UltraZKFlavor, UltraRollupFlavor > FlavorTypes
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
TYPED_TEST_SUITE(ShpleminiTest, TestSettings)
TYPED_TEST(ShpleminiTest, CorrectnessOfMultivariateClaimBatching)
VerifierCommitmentKey< Curve > vk
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13