Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions field/koalabear/vortex/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ func (p *Params) Verify(input VerifierInput) error {
return fmt.Errorf("invalid proof: uAlpha is not a reed-solomon codeword")
}

// This checks linear combination of the opened columns matches the requested position of the UAlpha
if p.checkColLinCombination(input) != nil {
return fmt.Errorf("invalid proof: uAlpha is not a correct linear combination")
}

// This checks the consistency between the proof and the selected columns
// to the input matrix.
for i, c := range input.SelectedColumns {
Expand All @@ -75,3 +80,24 @@ func (p *Params) Verify(input VerifierInput) error {
return nil

}

// Check linear combination of the opened columns matches the requested position of the UAlpha
func (p *Params) checkColLinCombination(input VerifierInput) error {
uAlpha := input.Proof.UAlpha

for i, selectedColID := range input.SelectedColumns {
if selectedColID < 0 || selectedColID >= len(uAlpha) {
return fmt.Errorf("column index %d is out of bounds for the linear combination array of size %d", selectedColID, len(uAlpha))
}

// Compute the linear combination of the opened column
y := EvalBasePolyHorner(input.Proof.OpenedColumns[i], input.Alpha)

// Check the consistency
if y != uAlpha[selectedColID] {
return fmt.Errorf("inconsistent linear combination at index %d (selected column ID %d): expected uAlpha[selectedColID] %s, got %s", i, selectedColID, uAlpha[selectedColID].String(), y.String())
}
}

return nil
}