Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
chonk.test.cpp File Reference

Go to the source code of this file.

Classes

class  ChonkTests
 
class  KernelIOTamperingTests
 

Functions

 TEST_F (ChonkTests, TestCircuitSizes)
 Test sizes of the circuits generated by MockCircuitProducer.
 
 TEST_F (ChonkTests, Basic)
 Test basic IVC.
 
 TEST_F (ChonkTests, BadProofFailure)
 Check that the IVC fails if an intermediate fold proof is invalid.
 
 TEST_F (ChonkTests, VKIndependenceFromNumberOfCircuits)
 Ensure that the hiding kernel VK is independent of the number of circuits accumulated.
 
 TEST_F (ChonkTests, VKIndependenceFromCircuitSize)
 Ensure that the hiding kernel VK is independent of the sizes of the circuits being accumulated.
 
 TEST_F (ChonkTests, MsgpackProofFromFileOrBuffer)
 Test to establish the "max" number of apps that can be accumulated due to limitations on the ECCVM size.
 
 TEST_F (ChonkTests, AppPairingInputsTamperingFailure)
 Test that tampering with app pairing inputs causes verification to fail.
 
 TEST_P (KernelIOTamperingTests, CausesVerificationFailure)
 
 INSTANTIATE_TEST_SUITE_P (All, KernelIOTamperingTests, testing::Values(KernelIOField::PAIRING_INPUTS, KernelIOField::ACCUMULATOR_HASH, KernelIOField::KERNEL_RETURN_DATA, KernelIOField::APP_RETURN_DATA, KernelIOField::ECC_OP_HASH), [](const testing::TestParamInfo< KernelIOField > &info) { switch(info.param) { case KernelIOField::PAIRING_INPUTS:return "PairingInputs";case KernelIOField::ACCUMULATOR_HASH:return "AccumulatorHash";case KernelIOField::KERNEL_RETURN_DATA:return "KernelReturnData";case KernelIOField::APP_RETURN_DATA:return "AppReturnData";case KernelIOField::ECC_OP_HASH:return "EccOpHash";} return "Unknown";})
 
 TEST_F (ChonkTests, AccumulatorBinding)
 Demonstrates that the HN accumulator chain cannot be broken.
 
 TEST_F (ChonkTests, SmallAppProvingMemory)
 Measure peak memory during chonk proving with a single small (2^10) app circuit.
 
 TEST_F (ChonkTests, ProofCompressionRoundtrip)
 
 TEST_F (ChonkTests, DecompressionRejectsNonCanonicalBN254Scalar)
 
 TEST_F (ChonkTests, DecompressionRejectsNonCanonicalBN254CommitmentX)
 
 TEST_F (ChonkTests, DecompressionRejectsInvalidBN254CurvePoint)
 
 TEST_F (ChonkTests, DecompressionRejectsTruncatedProof)
 

Function Documentation

◆ INSTANTIATE_TEST_SUITE_P()

INSTANTIATE_TEST_SUITE_P ( All  ,
KernelIOTamperingTests  ,
testing::Values(KernelIOField::PAIRING_INPUTS, KernelIOField::ACCUMULATOR_HASH, KernelIOField::KERNEL_RETURN_DATA, KernelIOField::APP_RETURN_DATA, KernelIOField::ECC_OP_HASH)  ,
[] (const testing::TestParamInfo< KernelIOField > &info) { switch(info.param) { case KernelIOField::PAIRING_INPUTS:return "PairingInputs";case KernelIOField::ACCUMULATOR_HASH:return "AccumulatorHash";case KernelIOField::KERNEL_RETURN_DATA:return "KernelReturnData";case KernelIOField::APP_RETURN_DATA:return "AppReturnData";case KernelIOField::ECC_OP_HASH:return "EccOpHash";} return "Unknown";}   
)

◆ TEST_F() [1/14]

TEST_F ( ChonkTests  ,
AccumulatorBinding   
)

Demonstrates that the HN accumulator chain cannot be broken.

We construct a Chonk instance using a first app with 1 << SMALL_LOG_2_NUM_GATES gates, accumulate this app and another MAX_APPS_PER_KERNEL - 1 to get a valid accumulator, then construct another Chonk instance where we accumulate a first app with 1 << (SMALL_LOG_2_NUM_GATES + 1) gates but substitute the accumulator after MAX_APPS_PER_KERNEL accumulations. We then check that the final proof fails verification, demonstrating that the accumulator is bound to the circuits that were accumulated and cannot be substituted with an accumulator from a different execution trace.

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

◆ TEST_F() [2/14]

TEST_F ( ChonkTests  ,
AppPairingInputsTamperingFailure   
)

Test that tampering with app pairing inputs causes verification to fail.

App circuits also output pairing points (AppIO). This test ensures that verification fails if we double these pairing points.

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

◆ TEST_F() [3/14]

TEST_F ( ChonkTests  ,
BadProofFailure   
)

Check that the IVC fails if an intermediate fold proof is invalid.

When accumulating 4 circuits, there are 3 fold proofs to verify (the first two are recursively verfied and the 3rd is verified as part of the IVC proof). Check that if any of one of these proofs is invalid, the IVC will fail.

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

◆ TEST_F() [4/14]

TEST_F ( ChonkTests  ,
Basic   
)

Test basic IVC.

Note
The circuits are of varying size: first circuit is 2^19, kernels are 2^18, apps are 2^17.

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

◆ TEST_F() [5/14]

TEST_F ( ChonkTests  ,
DecompressionRejectsInvalidBN254CurvePoint   
)

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

◆ TEST_F() [6/14]

TEST_F ( ChonkTests  ,
DecompressionRejectsNonCanonicalBN254CommitmentX   
)

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

◆ TEST_F() [7/14]

TEST_F ( ChonkTests  ,
DecompressionRejectsNonCanonicalBN254Scalar   
)

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

◆ TEST_F() [8/14]

TEST_F ( ChonkTests  ,
DecompressionRejectsTruncatedProof   
)

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

◆ TEST_F() [9/14]

TEST_F ( ChonkTests  ,
MsgpackProofFromFileOrBuffer   
)

Test to establish the "max" number of apps that can be accumulated due to limitations on the ECCVM size.

Test methods for serializing and deserializing a proof to/from a file/buffer in msgpack format

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

◆ TEST_F() [10/14]

TEST_F ( ChonkTests  ,
ProofCompressionRoundtrip   
)

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

◆ TEST_F() [11/14]

TEST_F ( ChonkTests  ,
SmallAppProvingMemory   
)

Measure peak memory during chonk proving with a single small (2^10) app circuit.

Accumulates a single small app and measures the peak RSS increase during the prove() phase. This isolates memory usage of the proving step when all accumulated apps are small.

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

◆ TEST_F() [12/14]

TEST_F ( ChonkTests  ,
TestCircuitSizes   
)

Test sizes of the circuits generated by MockCircuitProducer.

The sizes of the circuits depends on the TestSettings:

  • No settings: first app is 2^19, all other apps are 2^17, init kernel is 2^17, inner kernels are 2^18
  • Settings: apps are 2^(log2_num_gates + 2), all kernels are smaller than 2^19

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

◆ TEST_F() [13/14]

TEST_F ( ChonkTests  ,
VKIndependenceFromCircuitSize   
)

Ensure that the hiding kernel VK is independent of the sizes of the circuits being accumulated.

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

◆ TEST_F() [14/14]

TEST_F ( ChonkTests  ,
VKIndependenceFromNumberOfCircuits   
)

Ensure that the hiding kernel VK is independent of the number of circuits accumulated.

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

◆ TEST_P()

TEST_P ( KernelIOTamperingTests  ,
CausesVerificationFailure   
)

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