Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
chonk_batch_verifier.test.cpp
Go to the documentation of this file.
5
6using namespace bb;
7
8static constexpr size_t SMALL_LOG_2_NUM_GATES = 5;
9
10class ChonkBatchVerifierTests : public ::testing::Test {
11 protected:
13
14 using CircuitProducer = PrivateFunctionExecutionMockCircuitProducer;
15
17 size_t num_app_circuits = 1)
18 {
19 CircuitProducer circuit_producer(num_app_circuits);
20 const size_t num_circuits = circuit_producer.total_num_circuits;
21 Chonk ivc{ num_circuits };
22
23 TestSettings settings{ .log2_num_gates = SMALL_LOG_2_NUM_GATES };
24 for (size_t j = 0; j < num_circuits; ++j) {
25 circuit_producer.construct_and_accumulate_next_circuit(ivc, settings);
26 }
27 return { ivc.prove(), ivc.get_hiding_kernel_vk_and_hash() };
28 }
29};
30
31TEST_F(ChonkBatchVerifierTests, BatchVerifyTwoValidProofs)
32{
33 auto [proof1, vk1] = generate_chonk_proof();
34 auto [proof2, vk2] = generate_chonk_proof();
35
37 { std::move(proof1), vk1 },
38 { std::move(proof2), vk2 },
39 };
41}
42
43TEST_F(ChonkBatchVerifierTests, BatchVerifySingleProof)
44{
45 auto [proof, vk] = generate_chonk_proof();
46
48 { std::move(proof), vk },
49 };
51}
52
57TEST_F(ChonkBatchVerifierTests, BatchVerifyTamperedIPAProof)
58{
60
61 auto [proof1, vk1] = generate_chonk_proof();
62 auto [proof2, vk2] = generate_chonk_proof();
63
64 // Corrupt a field element in the IPA proof portion of the goblin proof
65 ASSERT_FALSE(proof2.goblin_proof.ipa_proof.empty());
66 proof2.goblin_proof.ipa_proof[0] = proof2.goblin_proof.ipa_proof[0] + bb::fr(1);
67
69 { std::move(proof1), vk1 },
70 { std::move(proof2), vk2 },
71 };
73}
74
78TEST_F(ChonkBatchVerifierTests, BatchVerifySwappedGoblinProofs)
79{
81
82 auto [proof1, vk1] = generate_chonk_proof();
83 auto [proof2, vk2] = generate_chonk_proof();
84
85 // Swap goblin proofs: each mega_proof is now paired with the wrong goblin proof
86 std::swap(proof1.goblin_proof, proof2.goblin_proof);
87
89 { std::move(proof1), vk1 },
90 { std::move(proof2), vk2 },
91 };
93}
#define BB_DISABLE_ASSERTS()
Definition assert.hpp:33
TEST_F(ChonkBatchVerifierTests, BatchVerifyTwoValidProofs)
PrivateFunctionExecutionMockCircuitProducer CircuitProducer
static std::pair< ChonkProof, std::shared_ptr< MegaZKFlavor::VKAndHash > > generate_chonk_proof(size_t num_app_circuits=1)
static bool verify(std::span< const Input > inputs)
Verify multiple Chonk proofs with batched IPA verification.
The IVC scheme used by the aztec client for private function execution.
Definition chonk.hpp:38
AvmProvingInputs inputs
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
::testing::Types< BN254Settings, GrumpkinSettings > TestSettings
field< Bn254FrParams > fr
Definition fr.hpp:155
VerifierCommitmentKey< Curve > vk
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13