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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
}

View File

@ -72,6 +72,8 @@ var appFlags = []cli.Flag{
flags.TerminalBlockHashOverride,
flags.TerminalBlockHashActivationEpochOverride,
flags.MevRelayEndpoint,
flags.MaxBuilderEpochMissedSlots,
flags.MaxBuilderConsecutiveMissedSlots,
cmd.EnableBackupWebhookFlag,
cmd.BackupWebhookOutputDir,
cmd.MinimalConfigFlag,

View File

@ -124,6 +124,8 @@ var appHelpFlagGroups = []flagGroup{
flags.Eth1HeaderReqLimit,
flags.MinPeersPerSubnet,
flags.MevRelayEndpoint,
flags.MaxBuilderEpochMissedSlots,
flags.MaxBuilderConsecutiveMissedSlots,
checkpoint.BlockPath,
checkpoint.StatePath,
checkpoint.RemoteURL,

View File

@ -253,8 +253,8 @@ var mainnetBeaconConfig = &BeaconChainConfig{
DefaultBuilderGasLimit: uint64(30000000),
// Mevboost circuit breaker
MaxBuilderConsecutiveMissedSlots: 4,
MaxBuilderEpochMissedSlots: 6,
MaxBuilderConsecutiveMissedSlots: 3,
MaxBuilderEpochMissedSlots: 8,
}
// MainnetTestConfig provides a version of the mainnet config that has a different name