3#include <gtest/gtest.h>
18using FlavorTypes = ::testing::Types<MegaFlavor, MegaZKFlavor>;
20template <
typename Flavor>
class MegaHonkTests :
public ::testing::Test {
42 Prover prover(prover_instance, verification_key);
45 bool verified = verifier.template verify_proof<DefaultIO>(proof).result;
69 DefaultIO::add_default(
builder);
92 bool honk_verified = this->construct_and_verify_honk_proof(
builder);
93 EXPECT_TRUE(honk_verified);
108 GTEST_SKIP() <<
"Skipping 'DynamicVirtualSizeIncrease' test for MegaZKFlavor.";
121 auto circuit_size = prover_instance->dyadic_size();
123 auto doubled_circuit_size = 2 * circuit_size;
124 prover_instance_copy->polynomials.increase_polynomials_virtual_size(doubled_circuit_size);
129 Prover prover(prover_instance, verification_key);
132 Prover prover_copy(prover_instance_copy, verification_key_copy);
134 for (
auto [entry, entry_copy] :
zip_view(verification_key->get_all(), verification_key_copy->get_all())) {
135 EXPECT_EQ(entry, entry_copy);
138 Verifier verifier(verification_key);
139 auto proof = prover.construct_proof();
141 auto relation_failures =
143 EXPECT_TRUE(relation_failures.empty());
144 bool result = verifier.template verify_proof<DefaultIO>(proof).result;
147 Verifier verifier_copy(verification_key_copy);
148 auto proof_copy = prover_copy.construct_proof();
150 auto relation_failures_copy =
152 EXPECT_TRUE(relation_failures.empty());
153 bool result_copy = verifier_copy.template verify_proof<DefaultIO>(proof_copy).result;
154 EXPECT_TRUE(result_copy);
170 GTEST_SKIP() <<
"Skipping 'PolySwap' test for MegaZKFlavor.";
184 for (
size_t i = 0; i < prover_instance_1->dyadic_size(); ++i) {
185 if (prover_instance_1->polynomials.q_arith[i] != 0) {
186 prover_instance_1->polynomials.w_l.at(i) += 1;
192 std::swap(prover_instance_1->polynomials, prover_instance_2->polynomials);
195 auto verification_key =
197 typename TestFixture::Prover prover(prover_instance_1, verification_key);
198 typename TestFixture::Verifier verifier(verification_key);
199 auto proof = prover.construct_proof();
200 bool result = verifier.template verify_proof<DefaultIO>(proof).result;
205 auto verification_key =
207 typename TestFixture::Prover prover(prover_instance_2, verification_key);
208 typename TestFixture::Verifier verifier(verification_key);
209 auto proof = prover.construct_proof();
210 bool result = verifier.template verify_proof<DefaultIO>(proof).result;
211 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.
The VerifierInstance encapsulates all the necessary information for a Mega Honk Verifier to verify a ...
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