Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ChonkTests Class Reference
Inheritance diagram for ChonkTests:
KernelIOTamperingTests

Public Types

using AccumulateHook = std::function< void(Chonk &, size_t)>
 Hook fired after each accumulate() inside run_ivc.
 

Static Public Member Functions

static void tamper_with_proof (HonkProof &proof, size_t public_inputs_offset)
 Tamper with a proof.
 
static std::pair< ChonkProof, std::shared_ptr< MegaZKFlavor::VKAndHash > > run_ivc (size_t num_app_circuits, TestSettings settings={}, const AccumulateHook &post_hook=nullptr, bool check_circuit_sizes=false)
 
static std::pair< ChonkProof, std::shared_ptr< MegaZKFlavor::VKAndHash > > run_ivc (std::vector< bool > leading_is_kernel_flags, TestSettings settings={}, const AccumulateHook &post_hook=nullptr, bool check_circuit_sizes=false)
 
static std::pair< ChonkProof, std::shared_ptr< MegaZKFlavor::VKAndHash > > accumulate_and_prove_ivc (size_t num_app_circuits, TestSettings settings={}, bool check_circuit_sizes=false)
 
static bool verify_chonk (const ChonkProof &proof, const std::shared_ptr< MegaZKFlavor::VKAndHash > &vk_and_hash)
 
static void test_app_io_tampering ()
 Helper function to test tampering with AppIO pairing inputs.
 
static void test_kernel_io_tampering (KernelIOField field_to_tamper)
 Helper function to test tampering with KernelIO fields.
 
static void test_kernel_return_data_propagation ()
 Helper function to test HidingKernelIO field propagation consistency.
 

Protected Types

using Flavor = Chonk::Flavor
 
using FF = typename Flavor::FF
 
using Commitment = Flavor::Commitment
 
using VerificationKey = Flavor::VerificationKey
 
using Builder = Chonk::ClientCircuit
 
using ProverInstance = Chonk::ProverInstance
 
using VerifierInstance = Chonk::VerifierInstance
 
using DeciderProver = Chonk::DeciderProver
 
using CircuitProducer = PrivateFunctionExecutionMockCircuitProducer
 
using ChonkVerifier = ChonkNativeVerifier
 

Static Protected Member Functions

static void SetUpTestSuite ()
 

Static Private Member Functions

static std::pair< ChonkProof, std::shared_ptr< MegaZKFlavor::VKAndHash > > run_ivc_impl (CircuitProducer &circuit_producer, TestSettings settings, const AccumulateHook &post_hook, bool check_circuit_sizes)
 

Detailed Description

Definition at line 43 of file chonk.test.cpp.

Member Typedef Documentation

◆ AccumulateHook

using ChonkTests::AccumulateHook = std::function<void(Chonk&, size_t)>

Hook fired after each accumulate() inside run_ivc.

Definition at line 62 of file chonk.test.cpp.

◆ Builder

Definition at line 51 of file chonk.test.cpp.

◆ ChonkVerifier

Definition at line 56 of file chonk.test.cpp.

◆ CircuitProducer

using ChonkTests::CircuitProducer = PrivateFunctionExecutionMockCircuitProducer
protected

Definition at line 55 of file chonk.test.cpp.

◆ Commitment

Definition at line 49 of file chonk.test.cpp.

◆ DeciderProver

Definition at line 54 of file chonk.test.cpp.

◆ FF

using ChonkTests::FF = typename Flavor::FF
protected

Definition at line 48 of file chonk.test.cpp.

◆ Flavor

using ChonkTests::Flavor = Chonk::Flavor
protected

Definition at line 47 of file chonk.test.cpp.

◆ ProverInstance

Definition at line 52 of file chonk.test.cpp.

◆ VerificationKey

Definition at line 50 of file chonk.test.cpp.

◆ VerifierInstance

Definition at line 53 of file chonk.test.cpp.

Member Function Documentation

◆ accumulate_and_prove_ivc()

static std::pair< ChonkProof, std::shared_ptr< MegaZKFlavor::VKAndHash > > ChonkTests::accumulate_and_prove_ivc ( size_t  num_app_circuits,
TestSettings  settings = {},
bool  check_circuit_sizes = false 
)
inlinestatic

Definition at line 102 of file chonk.test.cpp.

◆ run_ivc() [1/2]

static std::pair< ChonkProof, std::shared_ptr< MegaZKFlavor::VKAndHash > > ChonkTests::run_ivc ( size_t  num_app_circuits,
TestSettings  settings = {},
const AccumulateHook post_hook = nullptr,
bool  check_circuit_sizes = false 
)
inlinestatic

Definition at line 82 of file chonk.test.cpp.

◆ run_ivc() [2/2]

static std::pair< ChonkProof, std::shared_ptr< MegaZKFlavor::VKAndHash > > ChonkTests::run_ivc ( std::vector< bool >  leading_is_kernel_flags,
TestSettings  settings = {},
const AccumulateHook post_hook = nullptr,
bool  check_circuit_sizes = false 
)
inlinestatic

Definition at line 92 of file chonk.test.cpp.

◆ run_ivc_impl()

static std::pair< ChonkProof, std::shared_ptr< MegaZKFlavor::VKAndHash > > ChonkTests::run_ivc_impl ( CircuitProducer circuit_producer,
TestSettings  settings,
const AccumulateHook post_hook,
bool  check_circuit_sizes 
)
inlinestaticprivate

Definition at line 247 of file chonk.test.cpp.

◆ SetUpTestSuite()

static void ChonkTests::SetUpTestSuite ( )
inlinestaticprotected

Definition at line 45 of file chonk.test.cpp.

◆ tamper_with_proof()

static void ChonkTests::tamper_with_proof ( HonkProof proof,
size_t  public_inputs_offset 
)
inlinestatic

Tamper with a proof.

The first value in the proof after the public inputs is the commitment to the wire w.l (see OinkProver). We modify the commitment by adding Commitment::one().

Definition at line 70 of file chonk.test.cpp.

◆ test_app_io_tampering()

static void ChonkTests::test_app_io_tampering ( )
inlinestatic

Helper function to test tampering with AppIO pairing inputs.

Accumulates circuits, changes the app pairing points (creating valid but different points), and verifies that the final Chonk proof fails verification.

Definition at line 119 of file chonk.test.cpp.

◆ test_kernel_io_tampering()

static void ChonkTests::test_kernel_io_tampering ( KernelIOField  field_to_tamper)
inlinestatic

Helper function to test tampering with KernelIO fields.

Accumulates circuits, tampers with the specified field in the Init Kernel proof, and verifies that the final Chonk proof fails verification.

Definition at line 150 of file chonk.test.cpp.

◆ test_kernel_return_data_propagation()

static void ChonkTests::test_kernel_return_data_propagation ( )
inlinestatic

Helper function to test HidingKernelIO field propagation consistency.

Accumulates circuits, extracts the specified field from Tail kernel's proof, generates the final proof (which creates HidingKernel), and verifies the field propagated correctly to the HidingKernel's proof.

Note: This test does not perform proof tampering. Changing the public inputs of HidingKernel would lead to wrong challenges throughout the proof, so instead we verify that the expected input from the Tail kernel matches the expected output in the HidingKernel.

Definition at line 205 of file chonk.test.cpp.

◆ verify_chonk()

static bool ChonkTests::verify_chonk ( const ChonkProof proof,
const std::shared_ptr< MegaZKFlavor::VKAndHash > &  vk_and_hash 
)
inlinestatic

Definition at line 108 of file chonk.test.cpp.


The documentation for this class was generated from the following file: