Skip to content

Commit

Permalink
fix: collect only 1/2 of the shares from the row/col
Browse files Browse the repository at this point in the history
  • Loading branch information
vgonkivs committed Jul 4, 2023
1 parent f09539f commit 79aee83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion share/eds/byzantine/bad_encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (p *BadEncodingProof) Validate(hdr libhead.Header) error {
if int(p.Index) >= len(roots[rsmt2d.Row]) {
return fmt.Errorf("fraud: invalid proof: index out of bounds (%d >= %d)", int(p.Index), len(roots[rsmt2d.Row]))
}
if len(roots[rsmt2d.Row]) != len(p.Shares) {
if len(p.Shares) != len(roots[rsmt2d.Row]) {
return fmt.Errorf("fraud: invalid proof: incorrect number of shares %d != %d", len(p.Shares), len(roots[rsmt2d.Row]))
}

Expand Down
6 changes: 6 additions & 0 deletions share/eds/byzantine/byzantine.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ func NewErrByzantine(
dah.RowRoots,
}[errByz.Axis]
sharesWithProof := make([]*ShareWithProof, len(errByz.Shares))
counter := 0
for index, share := range errByz.Shares {
// collect only 1/2 of the shares
if counter == len(roots)/2 {
break
}
if share != nil {
share, err := getProofsAt(
ctx, bGetter,
Expand All @@ -57,6 +62,7 @@ func NewErrByzantine(
log.Fatalw("getting proof for ErrByzantine", "err", err)
}
sharesWithProof[index] = share
counter++
}
}
return &ErrByzantine{
Expand Down

0 comments on commit 79aee83

Please sign in to comment.