14#include <gtest/gtest.h>
57 Prover prover(prover_instance, verification_key);
80 ASSERT_EQ(polys.lagrange_ecc_op[ecc_op_start],
FF{ 1 })
81 <<
"lagrange_ecc_op should be active at row " << ecc_op_start;
84 auto ecc_op_wires = polys.get_ecc_op_wires();
85 auto wires = polys.get_wires();
86 for (
size_t r = ecc_op_start; polys.lagrange_ecc_op[r] ==
FF{ 1 }; r++) {
87 for (
auto [ecc_op_wire, wire] :
zip_view(ecc_op_wires, wires)) {
88 ASSERT_EQ(ecc_op_wire[r], wire[r + NUM_ZERO_ROWS]) <<
"ecc_op_wire / w_shift mismatch at row " << r;
93 FF original = polys.ecc_op_wire_1[ecc_op_start];
94 polys.ecc_op_wire_1.at(ecc_op_start) = original +
FF{ 1 };
97 polys,
instance->relation_parameters,
"EccOpQueue", ecc_op_start);
98 EXPECT_FALSE(failures.empty()) <<
"Corrupting ecc_op_wire at the boundary should cause EccOpQueueRelation failure";
101 polys.ecc_op_wire_1.at(ecc_op_start) = original;
112 auto& polys =
instance->polynomials;
115 for (
auto wire : polys.get_wires()) {
116 EXPECT_EQ(wire[0],
FF{ 0 }) <<
"Shiftable wire must have zero at row 0";
120 for (
auto wire : polys.get_wires()) {
121 bool has_masking =
false;
122 for (
size_t r = 1; r <= NUM_MASKED_ROWS; r++) {
123 has_masking |= (wire[r] !=
FF{ 0 });
125 EXPECT_TRUE(has_masking) <<
"Witness wire should have non-zero masking in rows 1-3";
139 auto& polys =
instance->polynomials;
152 for (
auto& [name, subrel_failures] : clean_failures) {
153 for (
auto& [subrel_idx, row] : subrel_failures) {
155 <<
"Relation " << name <<
" (subrelation " << subrel_idx <<
") fails at active row " << row;
166 auto& polys =
instance->polynomials;
171 EXPECT_EQ(polys.lagrange_first[r],
FF{ 0 }) <<
"lagrange_first should be 0 at disabled row " << r;
183 auto& polys =
instance->polynomials;
187 for (
auto ecc_op_wire : polys.get_ecc_op_wires()) {
189 EXPECT_EQ(ecc_op_wire[r],
FF{ 0 }) <<
"ecc_op_wire should be zero at row " << r <<
" (disabled region)";
201 EXPECT_TRUE(prove_and_verify(
instance));
219 const size_t dyadic_size = bad_instance->dyadic_size();
221 if (bad_instance->polynomials.q_arith[i] !=
FF{ 0 }) {
222 bad_instance->polynomials.w_l.at(i) +=
FF{ 1 };
227 EXPECT_TRUE(prove_and_verify(good_instance));
228 EXPECT_FALSE(prove_and_verify(bad_instance));
std::shared_ptr< Napi::ThreadSafeFunction > instance
static bool prove_and_verify(std::shared_ptr< ProverInstance > prover_instance)
Construct proof and verify.
static void SetUpTestSuite()
static std::shared_ptr< ProverInstance > build_instance()
Build a prover instance from a simple Mega circuit with ECC ops.
static void construct_simple_circuit(MegaBuilder &builder)
Generate a simple test circuit with some ECC op gates and conventional arithmetic gates.
MegaCircuitBuilder CircuitBuilder
bb::Polynomial< FF > Polynomial
NativeVerificationKey_< PrecomputedEntities< Commitment >, Codec, HashFunction, CommitmentKey > VerificationKey
The verification key stores commitments to the precomputed (non-witness) polynomials used by the veri...
Child class of MegaFlavor that runs with ZK Sumcheck.
Base Native verification key class.
Executes the "Oink" phase of the Honk proving protocol: the initial rounds that commit to witness dat...
void prove(bool emit_alpha=true)
Commit to witnesses, compute relation parameters, and prepare for Sumcheck.
Contains all the information required by a Honk prover to create a proof, constructed from a finalize...
static constexpr size_t TRACE_OFFSET
A debugging utility for checking whether a set of polynomials satisfies the relations for a given Fla...
static AllSubrelationFailures check_all(const auto &polynomials, const auto ¶ms)
Check that the provided polynomials satisfy all relations for a given Flavor.
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
Output verify_proof(const Proof &proof)
Perform ultra verification.
The VerifierInstance encapsulates all the necessary information for a Honk Verifier to verify a proof...
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
Entry point for Barretenberg command-line interface.
TEST_F(IPATest, ChallengesAreZero)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept