|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#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 |
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, KernelPairingInputsTamperingFailure) | |
| Test that tampering with kernel pairing inputs causes verification to fail. | |
| TEST_F (ChonkTests, AppPairingInputsTamperingFailure) | |
| Test that tampering with app pairing inputs causes verification to fail. | |
| TEST_F (ChonkTests, AccumulatorHashTamperingFailure) | |
| Verify that tampering with the accumulator hash in public inputs causes IVC verification failure. | |
| TEST_F (ChonkTests, KernelReturnDataTamperingFailure) | |
| Test that tampering with kernel_return_data causes verification to fail. | |
| TEST_F (ChonkTests, AppReturnDataTamperingFailure) | |
| Test that tampering with app_return_data causes verification to fail. | |
| TEST_F (ChonkTests, EccOpHashTamperingFailure) | |
| Test that tampering with ecc_op_hash causes verification to fail. | |
| 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) | |
| TEST_F | ( | ChonkTests | , |
| AccumulatorHashTamperingFailure | |||
| ) |
Verify that tampering with the accumulator hash in public inputs causes IVC verification failure.
Each kernel outputs output_hn_accum_hash as a public input. The next kernel computes the hash of its input accumulator and compares it with the hash from the previous kernel's public inputs via assert_equal. This test tampers with the hash to verify the binding.
Definition at line 484 of file chonk.test.cpp.
| 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 473 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| AppReturnDataTamperingFailure | |||
| ) |
Test that tampering with app_return_data causes verification to fail.
app_return_data is the commitment to the app's return data which must match the secondary_calldata commitment of the next circuit.
Definition at line 504 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 291 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| Basic | |||
| ) |
Test basic IVC.
Definition at line 276 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| DecompressionRejectsInvalidBN254CurvePoint | |||
| ) |
Definition at line 642 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| DecompressionRejectsNonCanonicalBN254CommitmentX | |||
| ) |
Definition at line 626 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| DecompressionRejectsNonCanonicalBN254Scalar | |||
| ) |
Definition at line 610 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| DecompressionRejectsTruncatedProof | |||
| ) |
Definition at line 662 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| EccOpHashTamperingFailure | |||
| ) |
Test that tampering with ecc_op_hash causes verification to fail.
ecc_op_hash commits to the folded ECC operation subtable commitments for batch merge verification.
Definition at line 513 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| KernelPairingInputsTamperingFailure | |||
| ) |
Test that tampering with kernel pairing inputs causes verification to fail.
Pairing points (P0, P1) accumulate across the IVC chain through aggregation. Even if we replace them with pairing points satisfying pairing check, the public input binding should must catch it.
Definition at line 463 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 523 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| KernelReturnDataTamperingFailure | |||
| ) |
Test that tampering with kernel_return_data causes verification to fail.
kernel_return_data is the commitment to the kernel's return data which must match the calldata commitment of the next circuit. Tampering should cause databus consistency check to fail.
Definition at line 494 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 420 of file chonk.test.cpp.
| TEST_F | ( | ChonkTests | , |
| ProofCompressionRoundtrip | |||
| ) |
Definition at line 563 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 533 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 252 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 382 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 367 of file chonk.test.cpp.