|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include "ultra_honk.test.hpp"#include "barretenberg/honk/proof_length.hpp"#include "barretenberg/honk/relation_checker.hpp"#include "barretenberg/ultra_honk/oink_prover.hpp"#include <gtest/gtest.h>Go to the source code of this file.
Typedefs | |
| using | AggregationState = stdlib::recursion::PairingPoints< UltraCircuitBuilder > |
| using | FlavorTypes = testing::Types< UltraFlavor, UltraZKFlavor, UltraKeccakFlavor, UltraKeccakZKFlavor > |
Functions | |
| TYPED_TEST_SUITE (UltraHonkTests, FlavorTypes) | |
| TYPED_TEST (UltraHonkTests, ProofLengthCheck) | |
| Check that size of a ultra honk proof matches the corresponding constant. | |
| TYPED_TEST (UltraHonkTests, PublicInputs) | |
| Test simple circuit with public inputs. | |
| TYPED_TEST (UltraHonkTests, TestNoLookupProof) | |
| TYPED_TEST (UltraHonkTests, TestEllipticGate) | |
| TYPED_TEST (UltraHonkTests, NonNativeFieldMultiplication) | |
| TYPED_TEST (UltraHonkTests, RangeChecksOnDuplicates) | |
| TYPED_TEST (UltraHonkTests, RangeConstraintSmallVariable) | |
| TYPED_TEST (UltraHonkTests, NativeVKHashMismatchDetected) | |
| Test that native verifier detects VK hash mismatch. | |
| TYPED_TEST (UltraHonkTests, TooShortProofRejected) | |
| Test that a truncated proof is rejected with a clear error message. | |
| TYPED_TEST (UltraHonkTests, TooLongProofRejected) | |
| Test that a proof with extra elements appended is rejected. | |
| TYPED_TEST (UltraHonkTests, DyadicSizeJumpsToProtectMaskingArea) | |
| Test that the dyadic size correctly jumps to the next power of 2 when the trace would otherwise place lagrange_last in the ZK masking region. | |
| TYPED_TEST (UltraHonkTests, DyadicSizeAccountsForTableOffset) | |
| Verify that dyadic circuit size accounts for lookup tables placed at the lookup block's trace offset. | |
| TYPED_TEST (UltraHonkTests, WitnessPolynomialsMasked) | |
| Verify that witness polynomials have masking values in the reserved head region. | |
| TYPED_TEST (UltraHonkTests, RepeatedCommitmentsIndicesCorrect) | |
| Verify that REPEATED_COMMITMENTS indices correctly pair to-be-shifted and shifted commitments. | |
Definition at line 10 of file ultra_honk.test.cpp.
| using FlavorTypes = testing::Types<UltraFlavor, UltraZKFlavor, UltraKeccakFlavor, UltraKeccakZKFlavor> |
Definition at line 20 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| DyadicSizeAccountsForTableOffset | |||
| ) |
Verify that dyadic circuit size accounts for lookup tables placed at the lookup block's trace offset.
Tables are allocated starting at lookup.trace_offset() (>= TRACE_OFFSET). The dyadic size must be large enough to contain them. This test populates a XOR lookup table and checks that the offset is past the disabled region and the dyadic size accommodates tables_end = table_offset + tables_size.
Definition at line 444 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| DyadicSizeJumpsToProtectMaskingArea | |||
| ) |
Test that the dyadic size correctly jumps to the next power of 2 when the trace would otherwise place lagrange_last in the ZK masking region.
For ZK flavors, the first NUM_MASKED_ROWS rows are overwritten with random values for zero-knowledge. We incrementally add gates until the dyadic size doubles, verifying at each step that: (1) lagrange_last (at final_active_wire_idx) does not overlap the masking area (2) sufficient headroom exists for disabled rows (3) at the boundary, the dyadic size doubles because the previous power of 2 was too small At the tightest packing (right before the jump), we also prove-and-verify.
Definition at line 380 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| NativeVKHashMismatchDetected | |||
| ) |
Test that native verifier detects VK hash mismatch.
The VKAndHash stores a precomputed hash of the VK. During verification, the oink verifier computes a fresh hash and compares it. If they don't match, a BB_ASSERT_EQ should trigger, catching potential VK tampering or corruption.
Definition at line 261 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| NonNativeFieldMultiplication | |||
| ) |
Definition at line 126 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| ProofLengthCheck | |||
| ) |
Check that size of a ultra honk proof matches the corresponding constant.
If this test FAILS, then the following (non-exhaustive) list should probably be updated as well:
Definition at line 32 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| PublicInputs | |||
| ) |
Test simple circuit with public inputs.
Definition at line 56 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| RangeChecksOnDuplicates | |||
| ) |
Definition at line 193 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| RangeConstraintSmallVariable | |||
| ) |
Definition at line 234 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| RepeatedCommitmentsIndicesCorrect | |||
| ) |
Verify that REPEATED_COMMITMENTS indices correctly pair to-be-shifted and shifted commitments.
Mirrors the Shplemini vector construction: [Q, unshifted..., to_be_shifted...] with offset = HasZK ? 2 : 1, then checks the same index pairs that remove_repeated_commitments asserts.
Definition at line 520 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| TestEllipticGate | |||
| ) |
Definition at line 91 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| TestNoLookupProof | |||
| ) |
Definition at line 68 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| TooLongProofRejected | |||
| ) |
Test that a proof with extra elements appended is rejected.
When a proof is too long, the derived num_public_inputs will be wrong, causing a mismatch with the VK's expected value.
Definition at line 335 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| TooShortProofRejected | |||
| ) |
Test that a truncated proof is rejected with a clear error message.
When a proof is too short, the verifier should detect this before unsigned integer underflow occurs in derive_num_public_inputs.
Definition at line 299 of file ultra_honk.test.cpp.
| TYPED_TEST | ( | UltraHonkTests | , |
| WitnessPolynomialsMasked | |||
| ) |
Verify that witness polynomials have masking values in the reserved head region.
Wires, z_perm, and lookup polynomials should have non-zero random values at rows 1..NUM_MASKED_ROWS.
Definition at line 482 of file ultra_honk.test.cpp.
| TYPED_TEST_SUITE | ( | UltraHonkTests | , |
| FlavorTypes | |||
| ) |