3#include <gtest/gtest.h>
18using FlavorTypes = ::testing::Types<MegaFlavor, MegaZKFlavor>;
20template <
typename Flavor>
class MegaHonkTests :
public ::testing::Test {
43 Prover prover(prover_instance, verification_key);
70 DefaultIO::add_default(
builder);
93 bool honk_verified = this->construct_and_verify_honk_proof(
builder);
94 EXPECT_TRUE(honk_verified);
109 GTEST_SKIP() <<
"Skipping 'DynamicVirtualSizeIncrease' test for MegaZKFlavor.";
122 auto circuit_size = prover_instance->dyadic_size();
124 auto doubled_circuit_size = 2 * circuit_size;
125 prover_instance_copy->polynomials.increase_polynomials_virtual_size(doubled_circuit_size);
130 Prover prover(prover_instance, verification_key);
133 Prover prover_copy(prover_instance_copy, verification_key_copy);
135 for (
auto [entry, entry_copy] :
zip_view(verification_key->get_all(), verification_key_copy->get_all())) {
136 EXPECT_EQ(entry, entry_copy);
140 Verifier verifier(vk_and_hash);
141 auto proof = prover.construct_proof();
143 auto relation_failures =
145 EXPECT_TRUE(relation_failures.empty());
146 bool result = verifier.verify_proof(proof).result;
150 Verifier verifier_copy(vk_and_hash_copy);
151 auto proof_copy = prover_copy.construct_proof();
153 auto relation_failures_copy =
155 EXPECT_TRUE(relation_failures.empty());
156 bool result_copy = verifier_copy.verify_proof(proof_copy).result;
157 EXPECT_TRUE(result_copy);
173 GTEST_SKIP() <<
"Skipping 'PolySwap' test for MegaZKFlavor.";
187 for (
size_t i = 0; i < prover_instance_1->dyadic_size(); ++i) {
188 if (prover_instance_1->polynomials.q_arith[i] != 0) {
189 prover_instance_1->polynomials.w_l.at(i) += 1;
195 std::swap(prover_instance_1->polynomials, prover_instance_2->polynomials);
198 auto verification_key =
201 typename TestFixture::Prover prover(prover_instance_1, verification_key);
202 typename TestFixture::Verifier verifier(vk_and_hash);
203 auto proof = prover.construct_proof();
204 bool result = verifier.verify_proof(proof).result;
209 auto verification_key =
212 typename TestFixture::Prover prover(prover_instance_2, verification_key);
213 typename TestFixture::Verifier verifier(vk_and_hash);
214 auto proof = prover.construct_proof();
215 bool result = verifier.verify_proof(proof).result;
216 EXPECT_FALSE(result);
Curve::AffineElement Point
typename Flavor::VerificationKey VerificationKey
static void SetUpTestSuite()
bool construct_and_verify_honk_proof(auto &builder)
Construct and a verify a Honk proof.
CommitmentKey object over a pairing group 𝔾₁.
Manages the data that is propagated on the public inputs of an application/function circuit.
static constexpr size_t PUBLIC_INPUTS_SIZE
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
ECCVMCircuitBuilder CircuitBuilder
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS
static void construct_simple_circuit(MegaBuilder &builder)
Generate a simple test circuit with some ECC op gates and conventional arithmetic gates.
A ProverInstance is normally constructed from a finalized circuit and it contains all the information...
static AllSubrelationFailures check_all(const auto &polynomials, const auto ¶ms)
Check that the provided polynomials satisfy all relations for a given Flavor.
Output verify_proof(const Proof &proof)
Perform ultra verification.
The VerifierInstance encapsulates all the necessary information for a Honk Verifier to verify a proof...
typename Group::affine_element AffineElement
Manages the data that is propagated on the public inputs of an application/function circuit.
RNG & get_debug_randomness(bool reset, std::uint_fast64_t seed)
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
Entry point for Barretenberg command-line interface.
std::vector< fr > HonkProof
TYPED_TEST_SUITE(ShpleminiTest, TestSettings)
TYPED_TEST(ShpleminiTest, CorrectnessOfMultivariateClaimBatching)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept