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

Beacon api: produce block should skip mev-boost #11488

Merged
merged 7 commits into from
Sep 23, 2022

Conversation

terencechain
Copy link
Member

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

When calling beacon API /eth/v2/validator/blocks/{slot} and /eth/v2/validator/blocks/{slot}/ssz, these end points should not call mev-boost/relayer to outsource block construction. This PR fixes it by adding field SkipMevBoost to BlockRequest such that if SkipMevBoost is true, the prysm API server will not attempt to reach mev-boost. This is the cleanest solution IMO, the other options are to refactor prysm API's get beacon block into two methods where one calls mev-boost and one doesn't

Which issues(s) does this PR fix?

Fixes #11481

Other notes for review

Given that this is a protobuf change, we'll need to be careful there's no backward compatibility issue between beacon node and validator.

@terencechain terencechain added the Bug Something isn't working label Sep 22, 2022
@terencechain terencechain self-assigned this Sep 22, 2022
@terencechain terencechain requested a review from a team as a code owner September 22, 2022 12:57
Comment on lines 47 to 62
if !req.SkipMevBoost {
registered, err := vs.validatorRegistered(ctx, altairBlk.ProposerIndex)
if registered && err == nil {
builderReady, b, err := vs.GetAndBuildBlindBlock(ctx, altairBlk)
if err != nil {
// In the event of an error, the node should fall back to default execution engine for building block.
log.WithError(err).Error("Failed to build a block from external builder, falling " +
"back to local execution client")
builderGetPayloadMissCount.Inc()
} else if builderReady {
return b, nil
}
} else if err != nil {
log.WithFields(logrus.Fields{
"slot": req.Slot,
"validatorIndex": altairBlk.ProposerIndex,
}).Errorf("Could not determine validator has registered. Default to local execution client: %v", err)
}
} else if err != nil {
log.WithFields(logrus.Fields{
"slot": req.Slot,
"validatorIndex": altairBlk.ProposerIndex,
}).Errorf("Could not determine validator has registered. Default to local execution client: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

Please add tests for these changes

Copy link
Member Author

Choose a reason for hiding this comment

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

req.SkipMevBoost is true is tested through TestProduceBlockV2SSZ and TestProduceBlockV2.
req.SkipMevBoost is false is tested through TestServer_GetBellatrixBeaconBlock_BuilderCase. Local test case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also added another local test TestServer_GetBellatrixBeaconBlock_LocalProgressingWithBuilderSkipped

Comment on lines 340 to 341
// By definition `/eth/v2/validator/blocks/{slot}/ssz`, does not produce block using mev-boost and relayer network:
// https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Validator/produceBlockV2
Copy link
Member

Choose a reason for hiding this comment

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

Please add a suggestion to which API endpoint is supposed to be used for MEV boost / relay. I.e. blinded blocks endpoint.

The link you provided doesn't define anything about whether or not mev-boost should be used.

terencechain and others added 2 commits September 23, 2022 10:49
@prylabs-bulldozer prylabs-bulldozer bot merged commit 211c5c2 into develop Sep 23, 2022
@delete-merged-branch delete-merged-branch bot deleted the skip-mev-boost branch September 23, 2022 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fetching beacon block through API triggers relay request
2 participants