|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Tests that validate correctness at the ZK masking boundaries. More...
#include <gtest/gtest.h>#include "barretenberg/circuit_checker/circuit_checker.hpp"#include "barretenberg/goblin/mock_circuits.hpp"#include "barretenberg/honk/relation_checker.hpp"#include "barretenberg/relations/ecc_op_queue_relation.hpp"#include "barretenberg/ultra_honk/oink_prover.hpp"#include "barretenberg/ultra_honk/ultra_prover.hpp"#include "barretenberg/ultra_honk/ultra_verifier.hpp"Go to the source code of this file.
Classes | |
| class | ZKBoundaryTests |
Functions | |
| TEST_F (ZKBoundaryTests, EccOpWireAlignmentAtDisabledBoundary) | |
| Verify ECC op wire alignment: ecc_op_wire[r] == w_shift[r] = w[r+1] at the boundary. | |
| TEST_F (ZKBoundaryTests, WitnessMaskingStructure) | |
| Verify that the disabled head rows (0-3) contain masking values in witness wires. | |
| TEST_F (ZKBoundaryTests, DisabledRegionIsolation) | |
| Corrupt a masking value in the disabled region and verify proof still passes. | |
| TEST_F (ZKBoundaryTests, LagrangeFirstPosition) | |
| Verify that lagrange_first is positioned correctly after the disabled region. | |
| TEST_F (ZKBoundaryTests, EccOpWiresZeroInDisabledRegion) | |
| Verify ECC op wires are zero in the disabled region (not masked). | |
| TEST_F (ZKBoundaryTests, ProveAndVerifyMegaZK) | |
| End-to-end: prove and verify a MegaZK circuit, confirming the full pipeline works with ECC ops. | |
| TEST_F (ZKBoundaryTests, CorruptionInActiveRegionFailsProof) | |
| Corrupt a witness in the active region (first gate after disabled rows) and verify that proof fails. | |
Tests that validate correctness at the ZK masking boundaries.
These tests verify that the disabled head region (rows 0-3) interacts correctly with the active trace, specifically around:
Tests are MegaZK-only since the disabled head region only exists for ZK flavors.
Definition in file zk_boundary.test.cpp.
| TEST_F | ( | ZKBoundaryTests | , |
| CorruptionInActiveRegionFailsProof | |||
| ) |
Corrupt a witness in the active region (first gate after disabled rows) and verify that proof fails.
Definition at line 208 of file zk_boundary.test.cpp.
| TEST_F | ( | ZKBoundaryTests | , |
| DisabledRegionIsolation | |||
| ) |
Corrupt a masking value in the disabled region and verify proof still passes.
The row-disabling polynomial kills rows 0-3, so any values there (including masking) should not affect relation correctness. Changing a masking value should still produce a valid proof (the change affects commitment/ZK but not soundness within the disabled region). This test verifies that the row-disabling polynomial properly isolates the disabled region.
Definition at line 136 of file zk_boundary.test.cpp.
| TEST_F | ( | ZKBoundaryTests | , |
| EccOpWireAlignmentAtDisabledBoundary | |||
| ) |
Verify ECC op wire alignment: ecc_op_wire[r] == w_shift[r] = w[r+1] at the boundary.
ecc_op_wire data starts at row TRACE_OFFSET (4 for MegaZK), while the block's data in w starts at row TRACE_OFFSET + NUM_ZERO_ROWS (5). The shift convention (w_shift[r] = w[r+1]) bridges the gap, so ecc_op_wire[TRACE_OFFSET + i] == w[TRACE_OFFSET + NUM_ZERO_ROWS + i]. This test checks the alignment holds and that corrupting it causes relation failure.
Definition at line 71 of file zk_boundary.test.cpp.
| TEST_F | ( | ZKBoundaryTests | , |
| EccOpWiresZeroInDisabledRegion | |||
| ) |
Verify ECC op wires are zero in the disabled region (not masked).
Unlike witness wires, ecc_op_wires are not masked (ZK for ops comes from random ops in the merge protocol). They should be zero at rows 0 through ecc_op_start-1.
Definition at line 180 of file zk_boundary.test.cpp.
| TEST_F | ( | ZKBoundaryTests | , |
| LagrangeFirstPosition | |||
| ) |
Verify that lagrange_first is positioned correctly after the disabled region.
Definition at line 163 of file zk_boundary.test.cpp.
| TEST_F | ( | ZKBoundaryTests | , |
| ProveAndVerifyMegaZK | |||
| ) |
End-to-end: prove and verify a MegaZK circuit, confirming the full pipeline works with ECC ops.
Definition at line 198 of file zk_boundary.test.cpp.
| TEST_F | ( | ZKBoundaryTests | , |
| WitnessMaskingStructure | |||
| ) |
Verify that the disabled head rows (0-3) contain masking values in witness wires.
Witness wires (w_l, w_r, w_o, w_4) should have random masking at rows {1,2,3} and zero at row 0 (shiftable constraint). This test asserts the structural invariant.
Definition at line 109 of file zk_boundary.test.cpp.