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

/eth/v1/beacon/blinded_blocks/{block_id} API endpoint #11538

Merged
merged 15 commits into from
Oct 19, 2022

Conversation

rkapka
Copy link
Contributor

@rkapka rkapka commented Oct 4, 2022

What type of PR is this?

Feature

What does this PR do? Why is it needed?

Implements fetching blinded blocks through the Beacon API as described in ethereum/beacon-APIs#241. See also https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Beacon/getBlindedBlock.

Other notes for review

This PR also adds missing ExecutionOptimistic field to the response of non-blinded SSZ version and improves a few small things in existing grpc endpoints.

@rkapka rkapka requested a review from a team as a code owner October 4, 2022 12:55
@rkapka rkapka added Ready For Review A pull request ready for code review API Api related tasks labels Oct 4, 2022
bellatrixBlk, err := blk.PbBellatrixBlock()
if err == nil {
if bellatrixBlk == nil {
return nil, status.Errorf(codes.Internal, "Nil block")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return nil, status.Errorf(codes.Internal, "Nil block")
return nil, status.Error(codes.Internal, "Nil block")

Copy link
Member

Choose a reason for hiding this comment

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

Same in other instances

Comment on lines +880 to +891
blindedBlkInterface, err := blk.ToBlinded()
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not convert block to blinded block: %v", err)
}
blindedBellatrixBlock, err := blindedBlkInterface.PbBlindedBellatrixBlock()
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not get signed beacon block: %v", err)
}
v2Blk, err := migration.V1Alpha1BeaconBlockBlindedBellatrixToV2Blinded(blindedBellatrixBlock.Block)
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not get signed beacon block: %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.

why convert to blind?

Copy link
Contributor

Choose a reason for hiding this comment

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

This endpoint is requesting a blinded block, so we must convert a bellatrix block to blinded format

Copy link
Member

Choose a reason for hiding this comment

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

Ah. Thanks

Copy link
Contributor

@rauljordan rauljordan left a comment

Choose a reason for hiding this comment

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

I reviewed @rkapka and aside from the minor suggestions from Terence, it looks good to merge

terencechain
terencechain previously approved these changes Oct 7, 2022
# Conflicts:
#	beacon-chain/rpc/apimiddleware/endpoint_factory.go
#	beacon-chain/rpc/apimiddleware/structs.go
@prylabs-bulldozer prylabs-bulldozer bot merged commit 6aab2b2 into develop Oct 19, 2022
@delete-merged-branch delete-merged-branch bot deleted the get-blinded-block branch October 19, 2022 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Api related tasks Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants