Skip to content

Commit

Permalink
Fix: division by zero panic in assignment (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-shim authored Mar 15, 2024
1 parent f37fb83 commit 28e3c4b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/assignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ func (c *StdAssignmentCoordinator) GetAssignments(state *OperatorState, blobLeng

gammaChunkLength := big.NewInt(int64(info.ChunkLength) * int64((info.QuorumThreshold - info.AdversaryThreshold)))
denom := new(big.Int).Mul(gammaChunkLength, totalStakes)
if denom.Cmp(big.NewInt(0)) == 0 {
return nil, AssignmentInfo{}, fmt.Errorf("gammaChunkLength %d and total stake in quorum %d must be greater than 0", gammaChunkLength, totalStakes)
}
m := roundUpDivideBig(num, denom)

numChunks += uint(m.Uint64())
Expand Down

0 comments on commit 28e3c4b

Please sign in to comment.