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.
 
 TEST_F (ECCVMRelationCorruptionTests, TranscriptNoOpRowRejectsAccumulatorNotEmpty)
 On a transcript no-op row, setting accumulator_not_empty=1 must be caught by subrelation 22.
 

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/4]

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 194 of file eccvm_relation_corruption.test.cpp.

◆ TEST_F() [2/4]

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 163 of file eccvm_relation_corruption.test.cpp.

◆ TEST_F() [3/4]

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 270 of file eccvm_relation_corruption.test.cpp.

◆ TEST_F() [4/4]

TEST_F ( ECCVMRelationCorruptionTests  ,
TranscriptNoOpRowRejectsAccumulatorNotEmpty   
)

On a transcript no-op row, setting accumulator_not_empty=1 must be caught by subrelation 22.

The accumulator_infinity_from_noop term in subrelation 22 forces is_accumulator_empty_shift = 1 whenever all selectors are zero. This test corrupts the shifted value (i.e. accumulator_not_empty at row+1) to 1 and verifies detection.

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