Skip to content

Commit

Permalink
additional check
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Dec 15, 2023
1 parent ffc9912 commit 219a01d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/encoding/kzgEncoder/multiframe.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,20 @@ func genRhsG1(samples []Sample, randomsFr []bls.Fr, m int, params rs.EncodingPar
// note the coeff is affected by how many chunks are validated per blob
// if x chunks are sampled from one blob, we need to compute the sum of all x random field element corresponding to each sample
aggCommitCoeffs := make([]bls.Fr, m)
setCommit := make([]bool, m)
for k := 0; k < n; k++ {
s := samples[k]
row := s.RowIndex
bls.AddModFr(&aggCommitCoeffs[row], &aggCommitCoeffs[row], &randomsFr[k])
bls.CopyG1(&commits[row], &s.Commitment)

if !setCommit[row] {
bls.CopyG1(&commits[row], &s.Commitment)
setCommit[row] = true
} else {
if !bls.EqualG1(&commits[row], &s.Commitment) {
return nil, errors.New("Samples of the same row has different commitments")
}
}
}

aggCommit := bls.LinCombG1(commits, aggCommitCoeffs)
Expand Down

0 comments on commit 219a01d

Please sign in to comment.