|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <functional>#include <ranges>#include <sys/resource.h>#include "barretenberg/chonk/chonk.hpp"#include "barretenberg/chonk/chonk_verifier.hpp"#include "barretenberg/chonk/mock_circuit_producer.hpp"#include "barretenberg/chonk/proof_compression.hpp"#include "barretenberg/chonk/test_bench_shared.hpp"#include "barretenberg/common/assert.hpp"#include "barretenberg/common/log.hpp"#include "barretenberg/common/mem.hpp"#include "barretenberg/common/test.hpp"#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"#include "barretenberg/goblin/goblin.hpp"#include "barretenberg/goblin/mock_circuits.hpp"#include "barretenberg/honk/proof_length.hpp"#include "barretenberg/serialize/msgpack_impl.hpp"#include "barretenberg/stdlib/special_public_inputs/special_public_inputs_test_serde.hpp"#include "barretenberg/stdlib_circuit_builders/mega_circuit_builder.hpp"#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"#include "gtest/gtest.h"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, KernelReturnDataPropagationConsistency) | |
| Test that kernel_return_data is consistently propagated from Tail kernel to HidingKernel proof. | |
| 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) | |
| 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 | , |
| 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 483 of file chonk.test.cpp.
| 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 312 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| Basic | |||
| ) |
Test basic IVC.
Definition at line 297 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| DecompressionRejectsInvalidBN254CurvePoint | |||
| ) |
Definition at line 640 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| DecompressionRejectsNonCanonicalBN254CommitmentX | |||
| ) |
Definition at line 624 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| DecompressionRejectsNonCanonicalBN254Scalar | |||
| ) |
Definition at line 608 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| DecompressionRejectsTruncatedProof | |||
| ) |
Definition at line 660 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| KernelReturnDataPropagationConsistency | |||
| ) |
Test that kernel_return_data is consistently propagated from Tail kernel to HidingKernel proof.
kernel_return_data commitment is placed in the Tail kernel's public inputs and must be propagated unchanged to the HidingKernel's public inputs.
Definition at line 521 of file chonk.test.cpp.
| 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 438 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| ProofCompressionRoundtrip | |||
| ) |
Definition at line 561 of file chonk.test.cpp.
| 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 531 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| TestCircuitSizes | |||
| ) |
Test sizes of the circuits generated by MockCircuitProducer.
The sizes of the circuits depends on the TestSettings:
Definition at line 273 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| VKIndependenceFromCircuitSize | |||
| ) |
Ensure that the hiding kernel VK is independent of the sizes of the circuits being accumulated.
Definition at line 401 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| VKIndependenceFromNumberOfCircuits | |||
| ) |
Ensure that the hiding kernel VK is independent of the number of circuits accumulated.
Definition at line 386 of file chonk.test.cpp.
| TEST_P | ( | KernelIOTamperingTests | , |
| CausesVerificationFailure | |||
| ) |
Definition at line 488 of file chonk.test.cpp.