Misc builder fixes (#11228)

* Fix a few bugs

* Fix test

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
terencechain
2022-08-16 12:10:40 -07:00
committed by GitHub
parent ccfc09151f
commit 8d3f474bfa
4 changed files with 15 additions and 11 deletions

View File

@@ -317,16 +317,16 @@ func (vs *Server) circuitBreakBuilder(s types.Slot) (bool, error) {
// Circuit breaker is active if the missing consecutive slots greater than `MaxBuilderConsecutiveMissedSlots`.
highestReceivedSlot := vs.ForkFetcher.ForkChoicer().HighestReceivedBlockSlot()
fallbackSlots := params.BeaconConfig().MaxBuilderConsecutiveMissedSlots
maxConsecutiveSkipSlotsAllowed := params.BeaconConfig().MaxBuilderConsecutiveMissedSlots
diff, err := s.SafeSubSlot(highestReceivedSlot)
if err != nil {
return true, err
}
if diff > fallbackSlots {
if diff > maxConsecutiveSkipSlotsAllowed {
log.WithFields(logrus.Fields{
"currentSlot": s,
"highestReceivedSlot": highestReceivedSlot,
"fallBackSkipSlots": fallbackSlots,
"currentSlot": s,
"highestReceivedSlot": highestReceivedSlot,
"maxConsecutiveSkipSlotsAllowed": maxConsecutiveSkipSlotsAllowed,
}).Warn("Builder circuit breaker activated due to missing consecutive slot")
return true, nil
}
@@ -341,15 +341,15 @@ func (vs *Server) circuitBreakBuilder(s types.Slot) (bool, error) {
if err != nil {
return true, err
}
fallbackSlotsLastEpoch := params.BeaconConfig().MaxBuilderEpochMissedSlots
maxEpochSkipSlotsAllowed := params.BeaconConfig().MaxBuilderEpochMissedSlots
diff, err = params.BeaconConfig().SlotsPerEpoch.SafeSub(receivedCount)
if err != nil {
return true, err
}
if diff > fallbackSlotsLastEpoch {
if diff > maxEpochSkipSlotsAllowed {
log.WithFields(logrus.Fields{
"totalMissed": receivedCount,
"fallBackSkipSlotsLastEpoch": fallbackSlotsLastEpoch,
"totalMissed": diff,
"maxEpochSkipSlotsAllowed": maxEpochSkipSlotsAllowed,
}).Warn("Builder circuit breaker activated due to missing enough slots last epoch")
return true, nil
}