6#include <gtest/gtest.h>
19 for (
auto [polynomial, commitment] :
zip_view(proving_key.get_precomputed(),
vk.get_all())) {
33 for (
const auto& commitment : commitments) {
34 auto frs = AvmFlavor::Transcript::Codec::serialize_to_fields(commitment);
35 for (
const auto&
fr : frs) {
36 elements.push_back(
fr);
39 return AvmFlavor::Transcript::HashFunction::hash(elements);
52TEST(AvmFixedVKTests, FixedVKCommitments)
61 auto vk_computed = from_proving_key_for_testing(*proving_key);
62 auto vk_computed_commitments = vk_computed.get_all();
68 EXPECT_EQ(vk_computed_commitments.size(), fixed_vk.get_all().size())
69 <<
"VK commitments size mismatch: computed has " << vk_computed_commitments.size() <<
" commitments, fixed has "
70 << fixed_vk.get_all().size();
73 auto labels = vk_computed.get_labels();
74 for (
size_t i = 0; i < vk_computed_commitments.size(); ++i) {
75 EXPECT_EQ(vk_computed_commitments[i], fixed_vk.get_all()[i])
76 <<
"Mismatch at index " << i <<
" (label: " << labels[i] <<
")";
80 FF vk_computed_hash = compute_vk_hash(vk_computed_commitments);
82 EXPECT_EQ(vk_computed_hash, fixed_vk_hash) <<
"VK hash mismatch";
Commitment commit(PolynomialSpan< const Fr > polynomial) const
Uses the ProverSRS to create a commitment to p(X)
Simple verification key class for fixed-size circuits (ECCVM, Translator, AVM).
CommitmentKey commitment_key
tracegen::TraceContainer generate_precomputed_columns()
AvmProver::ProverPolynomials compute_polynomials(tracegen::TraceContainer &trace)
std::shared_ptr< AvmProver::ProvingKey > proving_key_from_polynomials(AvmProver::ProverPolynomials &polynomials)
TEST(AvmFixedVKTests, FixedVKCommitments)
Test that the fixed VK commitments agree with the ones computed from precomputed columns.
uint256_t compute_vk_hash(const Builder &circuit_in)
Compute the hash of the verification key that results from constructing a proving key from the given ...
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
VerifierCommitmentKey< Curve > vk
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept