Skip to content
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 circuit breaker for relayer/builder #11215

Merged
merged 6 commits into from
Aug 15, 2022

Conversation

terencechain
Copy link
Member

This PR implements a circuit breaker for the builder/relayer infra to determine whether or not we should propose blocks through the builder API. This code doesn't live on the normal block proposal path, it lives in the builder block proposal path, and the risk factor is low. With that said, please careful review

The following flags are added:
--builder-fallback-skips (default value 4)
the number of slots before the proposal slot that has been skipped
--builder-fallback-skips-per-epoch (default value 6)
the number of slots in the last 32 slots that have been skipped

Would appreciate feedback on the defaults!

@terencechain terencechain added Ready For Review Builder PR or issue that supports builder related work labels Aug 12, 2022
@terencechain terencechain self-assigned this Aug 12, 2022
@terencechain terencechain requested a review from a team as a code owner August 12, 2022 19:39
@@ -65,6 +65,24 @@ func configureSafeSlotsToImportOptimistically(cliCtx *cli.Context) error {
return nil
}

func configureMevBoostCircuitBreakerValues(cliCtx *cli.Context) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should name it form configureMevBoostCircuitBreakerValues toconfigureBuilderCircuitBreaker

func configureMevBoostCircuitBreakerValues(cliCtx *cli.Context) error {
if cliCtx.IsSet(flags.BuilderFallbackSkips.Name) {
c := params.BeaconConfig().Copy()
c.BuilderFallbackSkipsSlot = types.Slot(cliCtx.Int(flags.BuilderFallbackSkips.Name))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe rename to MaxBuilderConsecutiveMissedSlots telling the system that there should be a max of x slots missed before falling back to something

}
if cliCtx.IsSet(flags.BuilderFallbackSkipsPerEpoch.Name) {
c := params.BeaconConfig().Copy()
c.BuilderFallbackSkipsSlotsLastEpoch = types.Slot(cliCtx.Int(flags.BuilderFallbackSkipsPerEpoch.Name))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and corresponding MaxBuilderMissedSlotsInEpoch


circuitBreak, err := vs.circuitBreakBuilder(b.Slot)
if err != nil {
return false, nil, errors.Wrap(err, "could not determine if builder circuit breaker condition")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe remove the if statement

@@ -16,6 +16,16 @@ var (
Usage: "A MEV builder relay string http endpoint, this wil be used to interact MEV builder network using API defined in: https://ethereum.github.io/builder-specs/#/Builder",
Value: "",
}
BuilderFallbackSkips = &cli.IntFlag{
Name: "builder-fallback-skips",
Usage: "Number of consecutive skip slot to fallback from using relay/builder to local execution engine for block construction",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related to flag name changes

Copy link
Contributor

@james-prysm james-prysm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving but might want a second pair of eyes maybe?

@rauljordan
Copy link
Contributor

Really nice PR, thanks for putting it together in a concise manner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Builder PR or issue that supports builder related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants