12#include <gtest/gtest.h>
21template <
typename VK>
auto compute_stdlib_vk_hash(
const VK&
vk)
23 using FF =
typename VK::FF;
24 using Builder =
typename VK::Builder;
27 auto serialize_to_field_buffer = []<
typename T>(
const T& input, std::vector<FF>&
buffer) {
28 std::vector<FF> input_fields = Codec::template serialize_to_fields<T>(input);
29 buffer.insert(
buffer.end(), input_fields.begin(), input_fields.end());
32 std::vector<FF> elements;
33 serialize_to_field_buffer(
vk.log_circuit_size, elements);
34 serialize_to_field_buffer(
vk.num_public_inputs, elements);
35 serialize_to_field_buffer(
vk.pub_inputs_offset, elements);
37 for (
const auto& commitment :
vk.get_all()) {
38 serialize_to_field_buffer(commitment, elements);
53using FlavorTypes = testing::Types<UltraRecursiveFlavor_<UltraCircuitBuilder>,
65 using NativeFlavor =
typename Flavor::NativeFlavor;
66 using NativeVerificationKey =
typename NativeFlavor::VerificationKey;
75 using InnerBuilder =
typename NativeFlavor::CircuitBuilder;
82 OuterBuilder outer_builder;
83 StdlibVerificationKey
vk(&outer_builder, native_vk);
86 FF vk_hash_1 = compute_stdlib_vk_hash(
vk);
90 FF vk_hash_2 =
vk.hash_with_origin_tagging(transcript);
91 EXPECT_EQ(vk_hash_1.get_value(), vk_hash_2.get_value());
static void SetUpTestSuite()
typename Flavor::NativeFlavor NativeFlavor
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
ECCVMCircuitBuilder CircuitBuilder
FixedVKAndHash_< PrecomputedEntities< Commitment >, BF, ECCVMHardcodedVKAndHash > VerificationKey
The verification key stores commitments to the precomputed polynomials used by the verifier.
BaseTranscript< Codec, HashFunction > Transcript
The recursive counterpart to the "native" Mega flavor.
Contains all the information required by a Honk prover to create a proof, constructed from a finalize...
The recursive counterpart to the "native" Ultra flavor.
static FF hash(const std::vector< FF > &input)
Hashes a vector of field elements.
static void add_default(Builder &builder)
Add default public inputs when they are not present.
std::unique_ptr< uint8_t[]> buffer
testing::Types< UltraFlavor, UltraKeccakFlavor, MegaFlavor > FlavorTypes
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
Entry point for Barretenberg command-line interface.
TYPED_TEST_SUITE(CommitmentKeyTest, Curves)
TYPED_TEST(CommitmentKeyTest, CommitToZeroPoly)
VerifierCommitmentKey< Curve > vk
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
StdlibCodec for in-circuit (recursive) verification transcript handling.