Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ultra_honk.test.cpp File Reference
#include "ultra_honk.test.hpp"
#include "barretenberg/honk/proof_length.hpp"
#include "barretenberg/honk/relation_checker.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, ANonZeroPolynomialIsAGoodPolynomial)
 A quick test to ensure that none of our polynomials are identically zero.
 
 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.
 

Typedef Documentation

◆ AggregationState

◆ FlavorTypes

Definition at line 19 of file ultra_honk.test.cpp.

Function Documentation

◆ TYPED_TEST() [1/12]

TYPED_TEST ( UltraHonkTests  ,
ANonZeroPolynomialIsAGoodPolynomial   
)

A quick test to ensure that none of our polynomials are identically zero.

Note
This test assumes that gates have been added by default in the composer to achieve non-zero polynomials

Definition at line 58 of file ultra_honk.test.cpp.

◆ TYPED_TEST() [2/12]

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 last 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 418 of file ultra_honk.test.cpp.

◆ TYPED_TEST() [3/12]

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 299 of file ultra_honk.test.cpp.

◆ TYPED_TEST() [4/12]

TYPED_TEST ( UltraHonkTests  ,
NonNativeFieldMultiplication   
)

Definition at line 164 of file ultra_honk.test.cpp.

◆ TYPED_TEST() [5/12]

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:

  • Proof length formula in ultra_flavor.hpp, mega_flavor.hpp, etc...
  • ultra_transcript.test.cpp
  • constants in yarn-project in: constants.nr, constants.gen.ts, ConstantsGen.sol, lib.nr in bb_proof_verification/src, main.nr of recursive acir_tests programs. with recursive verification circuits
  • Places that define SIZE_OF_PROOF_IF_LOGN_IS_28

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

◆ TYPED_TEST() [6/12]

TYPED_TEST ( UltraHonkTests  ,
PublicInputs   
)

Test simple circuit with public inputs.

Definition at line 94 of file ultra_honk.test.cpp.

◆ TYPED_TEST() [7/12]

TYPED_TEST ( UltraHonkTests  ,
RangeChecksOnDuplicates   
)

Definition at line 231 of file ultra_honk.test.cpp.

◆ TYPED_TEST() [8/12]

TYPED_TEST ( UltraHonkTests  ,
RangeConstraintSmallVariable   
)

Definition at line 272 of file ultra_honk.test.cpp.

◆ TYPED_TEST() [9/12]

TYPED_TEST ( UltraHonkTests  ,
TestEllipticGate   
)

Definition at line 129 of file ultra_honk.test.cpp.

◆ TYPED_TEST() [10/12]

TYPED_TEST ( UltraHonkTests  ,
TestNoLookupProof   
)

Definition at line 106 of file ultra_honk.test.cpp.

◆ TYPED_TEST() [11/12]

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 373 of file ultra_honk.test.cpp.

◆ TYPED_TEST() [12/12]

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 337 of file ultra_honk.test.cpp.

◆ TYPED_TEST_SUITE()

TYPED_TEST_SUITE ( UltraHonkTests  ,
FlavorTypes   
)