Skip to content

Commit

Permalink
Do not panic when a quorum has zero stake. (Layr-Labs#1233)
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Littley <cody@eigenlabs.org>
  • Loading branch information
cody-littley authored Feb 7, 2025
1 parent 7b87f62 commit ffdf18a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/aggregation.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,13 @@ func GetStakeThreshold(state *OperatorState, quorum QuorumID, quorumThreshold ui
}

func GetSignedPercentage(state *OperatorState, quorum QuorumID, stakeAmount *big.Int) uint8 {
totalStake := state.Totals[quorum].Stake
if totalStake.Cmp(big.NewInt(0)) == 0 {
return 0
}

stakeAmount = stakeAmount.Mul(stakeAmount, new(big.Int).SetUint64(percentMultiplier))
quorumThresholdBig := stakeAmount.Div(stakeAmount, state.Totals[quorum].Stake)
quorumThresholdBig := stakeAmount.Div(stakeAmount, totalStake)

quorumThreshold := uint8(quorumThresholdBig.Uint64())

Expand Down

0 comments on commit ffdf18a

Please sign in to comment.