Skip to content

Commit

Permalink
polish message
Browse files Browse the repository at this point in the history
  • Loading branch information
jianoaix committed Dec 12, 2023
1 parent e8fbb03 commit e9e7096
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions churner/churner.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,19 @@ func (c *churner) getOperatorsToChurn(ctx context.Context, quorumIDs []uint8, op
// register needs to have 1.1 times the stake of the lowest-stake operator.
if new(big.Int).Mul(lowestStake, churnBIPsOfOperatorStake).Cmp(new(big.Int).Mul(operatorToRegisterStake, bipMultiplier)) >= 0 {
c.metrics.IncrementFailedRequestNum("getOperatorsToChurn", FailReasonInsufficientStakeToRegister)
return nil, fmt.Errorf("registering operator must have more than %f times of the stake of the lowest-stake operator", float64(operatorSetParams.ChurnBIPsOfOperatorStake)/10000.0)
return nil, fmt.Errorf("registering operator must have %f%% more than the stake of the lowest-stake operator", float64(operatorSetParams.ChurnBIPsOfOperatorStake)/100.0-100.0)
}

// verify the lowest stake against the total stake
// make sure that: lowestStake * bipMultiplier < totalStake * churnBIPsOfTotalStake
// This for the lowest-stake operator to be churned out, it must have less than
// For the lowest-stake operator to be churned out, it must have less than
// churnBIPsOfTotalStake/10000 of the total stake.
// For example, when churnBIPsOfTotalStake=1001, the operator to be churned out
// (i.e. the lowest-stake operator) needs to have less than 10.01% of the total
// stake.
if new(big.Int).Mul(lowestStake, bipMultiplier).Cmp(new(big.Int).Mul(totalStake, churnBIPsOfTotalStake)) >= 0 {
c.metrics.IncrementFailedRequestNum("getOperatorsToChurn", FailReasonInsufficientStakeToChurn)
return nil, fmt.Errorf("operator to churn out must have less than %f percentage of the total stake", float64(operatorSetParams.ChurnBIPsOfTotalStake)/100.0)
return nil, fmt.Errorf("operator to churn out must have less than %f%% of the total stake", float64(operatorSetParams.ChurnBIPsOfTotalStake)/100.0)
}

operatorToChurnAddress, err := c.Transactor.OperatorIDToAddress(ctx, lowestStakeOperatorId)
Expand Down

0 comments on commit e9e7096

Please sign in to comment.