-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nonsigning rate threshold control to ejector #601
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,25 +54,27 @@ func computePerfScore(metric *OperatorNonsigningPercentageMetrics) float64 { | |
} | ||
|
||
type Ejector struct { | ||
wallet walletsdk.Wallet | ||
ethClient common.EthClient | ||
logger logging.Logger | ||
transactor core.Transactor | ||
metrics *Metrics | ||
txnTimeout time.Duration | ||
wallet walletsdk.Wallet | ||
ethClient common.EthClient | ||
logger logging.Logger | ||
transactor core.Transactor | ||
metrics *Metrics | ||
txnTimeout time.Duration | ||
nonsigningRateThreshold int | ||
|
||
// For serializing the ejection requests. | ||
mu sync.Mutex | ||
} | ||
|
||
func NewEjector(wallet walletsdk.Wallet, ethClient common.EthClient, logger logging.Logger, tx core.Transactor, metrics *Metrics, txnTimeout time.Duration) *Ejector { | ||
func NewEjector(wallet walletsdk.Wallet, ethClient common.EthClient, logger logging.Logger, tx core.Transactor, metrics *Metrics, txnTimeout time.Duration, nonsigningRateThreshold int) *Ejector { | ||
return &Ejector{ | ||
wallet: wallet, | ||
ethClient: ethClient, | ||
logger: logger.With("component", "Ejector"), | ||
transactor: tx, | ||
metrics: metrics, | ||
txnTimeout: txnTimeout, | ||
wallet: wallet, | ||
ethClient: ethClient, | ||
logger: logger.With("component", "Ejector"), | ||
transactor: tx, | ||
metrics: metrics, | ||
txnTimeout: txnTimeout, | ||
nonsigningRateThreshold: nonsigningRateThreshold, | ||
} | ||
} | ||
|
||
|
@@ -82,6 +84,11 @@ func (e *Ejector) Eject(ctx context.Context, nonsigningRate *OperatorsNonsigning | |
|
||
nonsigners := make([]*OperatorNonsigningPercentageMetrics, 0) | ||
for _, metric := range nonsigningRate.Data { | ||
// If nonsigningRateThreshold is set and valid, we will only eject operators with | ||
// nonsigning rate >= nonsigningRateThreshold. | ||
if e.nonsigningRateThreshold >= 10 && e.nonsigningRateThreshold <= 100 && metric.Percentage < float64(e.nonsigningRateThreshold) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if e.nonsigningRateThreshold is 9, then regular SLA is enforced. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In first case: e.nonsigningRateThreshold will have no effect, it will just perform regular ejection In second case: it'll eject an operator if 1) the operator violates SLA; AND 2) the operator's nonsigning rate >= 50% Note: when it's regular ejection, only condition 1) is used |
||
continue | ||
} | ||
// Collect only the nonsigners who violate the SLA. | ||
if metric.Percentage/100.0 > 1-stakeShareToSLA(metric.StakePercentage/100.0) { | ||
nonsigners = append(nonsigners, metric) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disabling the flag means, eject based on regular SLA?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, no additional conditions to affect the standard SLA and ejection flow.