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: fix get blind block #11304

Merged
merged 7 commits into from
Aug 25, 2022
Merged

Conversation

terencechain
Copy link
Member

Fixes #11293

The current beacon API for getting blind blocks has many incorrect assumptions:

  • Returns blocks from all forks
  • The validator has to be registered through the same beacon node

Instead, we should simplify the get blind block endpoint to return an error if any of these is true

  • The current time is before Bellatrix fork epoch.
  • The requested slot is before Bellatrix fork epoch.
  • The node is the syncing or optimistic mode.
  • The builder is not figured.
  • The relayer circuit breaker is activated.
  • The relayer responded with an error.

In the happy path, the endpoint will return a block with a header that's through the relay/builder network

@terencechain terencechain added Bug Something isn't working API Api related tasks Builder PR or issue that supports builder related work labels Aug 24, 2022
@terencechain terencechain self-assigned this Aug 24, 2022
@terencechain terencechain requested a review from a team as a code owner August 24, 2022 18:47
Comment on lines 408 to 409
// - The current time is before bellatrix fork epoch.
// - The requested slot is before bellatrix fork epoch.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is against the spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Beacon/publishBlindedBlock

Pre-Bellatrix, this endpoint will accept a SignedBeaconBlock.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's publish, not produce. but i see it's the same with produce, that's annoying, I'll have to add the original code back:
https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Validator/produceBlindedBlock

Copy link
Member Author

Choose a reason for hiding this comment

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

It makes no sense to produce a non-blind block IMO

if optimistic {
return nil, status.Errorf(codes.Unavailable, "The node is currently optimistic and cannot serve validators")
}
altairBlk, err := vs.V1Alpha1Server.BuildAltairBeaconBlock(ctx, v1alpha1req)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we build an Altair block here, not Bellatrix?

Copy link
Member Author

Choose a reason for hiding this comment

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

Build Altair block as the base, then insert header to turn that into a blind Bellatrix block.
Similar workflow for the non-blind block as well

@prylabs-bulldozer prylabs-bulldozer bot merged commit 1d07bff into develop Aug 25, 2022
@delete-merged-branch delete-merged-branch bot deleted the beacon-api-get-blind-blk branch August 25, 2022 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Api related tasks Bug Something isn't working Builder PR or issue that supports builder related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blinded block generation should not require validator registration
2 participants