Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
eccvm_relation_corruption.test.cpp File Reference

Corruption/negative tests for ECCVM relation constraints. More...

Go to the source code of this file.

Classes

class  ECCVMRelationCorruptionTests
 

Functions

 TEST_F (ECCVMRelationCorruptionTests, MSMAccumulatorCorruptionAtTransitionRowIsHarmless)
 Show that corrupting the accumulator at row 1 (msm_transition=1) does NOT break the MSM relation.
 
 TEST_F (ECCVMRelationCorruptionTests, MSMAccumulatorCorruptionAtInteriorAndNoOpRows)
 Corrupt the MSM accumulator at an interior active row and at a trailing no-op row.
 
 TEST_F (ECCVMRelationCorruptionTests, MSMRelationFailsOnShiftedMSMTable)
 Shift every MSM column down by one row, inserting a zero row at row 1.
 

Detailed Description

Corruption/negative tests for ECCVM relation constraints.

Each test builds valid ProverPolynomials from a real ECCVMCircuitBuilder, asserts that relations pass on clean data, then corrupts specific witness values and verifies detection.

Definition in file eccvm_relation_corruption.test.cpp.

Function Documentation

◆ TEST_F() [1/3]

TEST_F ( ECCVMRelationCorruptionTests  ,
MSMAccumulatorCorruptionAtInteriorAndNoOpRows   
)

Corrupt the MSM accumulator at an interior active row and at a trailing no-op row.

Part 1 targets an interior addition row (q_add=1, msm_transition=0). Unlike the transition row, the interior addition directly uses acc as input to the point-addition chain, so corrupting it breaks the addition subrelations.

Part 2 targets a trailing no-op row where all MSM selectors are zero. Here the no-op preservation constraints (subrelations 45-46) enforce acc_shift == acc.

Definition at line 178 of file eccvm_relation_corruption.test.cpp.

◆ TEST_F() [2/3]

TEST_F ( ECCVMRelationCorruptionTests  ,
MSMAccumulatorCorruptionAtTransitionRowIsHarmless   
)

Show that corrupting the accumulator at row 1 (msm_transition=1) does NOT break the MSM relation.

Row 1 is the first active MSM row with msm_transition=1. The first_add lambda in the MSM relation replaces the accumulator with the offset generator when msm_transition=1: x = xo * msm_transition + acc_x * (-msm_transition + 1) So when msm_transition=1, acc_x and acc_y are completely unused — corrupting them is harmless. This test documents that behavior explicitly.

Definition at line 147 of file eccvm_relation_corruption.test.cpp.

◆ TEST_F() [3/3]

TEST_F ( ECCVMRelationCorruptionTests  ,
MSMRelationFailsOnShiftedMSMTable   
)

Shift every MSM column down by one row, inserting a zero row at row 1.

For every MSM polynomial p, we set: p_new[0] = p[0] (row 0 is reserved for shifts, always zero) p_new[1] = 0 (injected blank row) p_new[k] = p[k-1] for k >= 2

This shifts all real MSM data one row later. Row 1, which was the first active MSM row (msm_transition = 1, q_add = 1, nonzero accumulator), becomes a no-op with zero accumulator. But the non-MSM columns (e.g. lagrange polynomials, precompute columns) are NOT shifted, so there's a mismatch. The no-op constraint (subrelations 45-46) forces acc_shift == acc at the now-empty row 1, but the shifted row 2 carries a nonzero accumulator from what was originally the row-1 computation, causing a detected violation.

Definition at line 254 of file eccvm_relation_corruption.test.cpp.