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

Public Types

enum class  KernelIOField {
  PAIRING_INPUTS , ACCUMULATOR_HASH , KERNEL_RETURN_DATA , APP_RETURN_DATA ,
  ECC_OP_TABLES
}
 Enum for specifying which KernelIO field to tamper with in tests. More...
 
enum class  HidingKernelIOField { PAIRING_INPUTS , KERNEL_RETURN_DATA , ECC_OP_TABLES }
 Enum for specifying which HidingKernelIO field to test for propagation consistency. More...
 

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 > > 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_hiding_kernel_io_propagation (HidingKernelIOField field_to_test)
 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 ()
 

Detailed Description

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

Member Typedef Documentation

◆ Builder

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

◆ ChonkVerifier

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

◆ CircuitProducer

using ChonkTests::CircuitProducer = PrivateFunctionExecutionMockCircuitProducer
protected

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

◆ Commitment

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

◆ DeciderProver

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

◆ FF

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

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

◆ Flavor

using ChonkTests::Flavor = Chonk::Flavor
protected

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

◆ ProverInstance

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

◆ VerificationKey

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

◆ VerifierInstance

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

Member Enumeration Documentation

◆ HidingKernelIOField

Enum for specifying which HidingKernelIO field to test for propagation consistency.

Enumerator
PAIRING_INPUTS 
KERNEL_RETURN_DATA 
ECC_OP_TABLES 

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

◆ KernelIOField

enum class ChonkTests::KernelIOField
strong

Enum for specifying which KernelIO field to tamper with in tests.

Enumerator
PAIRING_INPUTS 
ACCUMULATOR_HASH 
KERNEL_RETURN_DATA 
APP_RETURN_DATA 
ECC_OP_TABLES 

Definition at line 79 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 57 of file chonk.test.cpp.

◆ SetUpTestSuite()

static void ChonkTests::SetUpTestSuite ( )
inlinestaticprotected

Definition at line 25 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 45 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, doubles the app pairing points (creating valid but different points), and verifies that the final Chonk proof fails verification.

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

◆ test_hiding_kernel_io_propagation()

static void ChonkTests::test_hiding_kernel_io_propagation ( HidingKernelIOField  field_to_test)
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 202 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 135 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 70 of file chonk.test.cpp.


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