-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Use v1alpha1 server in block production #12336
Conversation
# Conflicts: # beacon-chain/rpc/eth/validator/validator_test.go
} | ||
|
||
return bs.submitBlock(ctx, root, wrappedCapellaBlk) | ||
return nil | ||
} | ||
|
||
func (bs *Server) submitBlock(ctx context.Context, blockRoot [fieldparams.RootLength]byte, block interfaces.ReadOnlySignedBeaconBlock) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change I think SubmitBlockSSZ and SubmitBlindedBlockSSZ can be addressed and have submit block just removed and just use 1 such as propose beacon block. will be less logic all over the place.
that being said I wonder if the unblind block logic is fine. at first glance it seems so and that seems to be the biggest difference between the submit block and proposeGenericBeaconBlock aside from the fact that the broadcaster is part is referenced from a different object.
if err != nil { | ||
return status.Errorf(codes.InvalidArgument, "Could not tree hash block: %v", err) | ||
return status.Errorf(codes.Internal, "Could not propose block: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be more custom if we are allowing for invalid argument code... otherwise, it'll return a 500 error when it should have been status.Errorf(codes.InvalidArgument, "Could not prepare block").
this will apply for all the other error handling logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The v1alpha1 server returns a simple error
, so it's hard to figure out when to return what kind of error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we still use error contains or error is and have some of the errors handled returning the appropriate error code?
like this return status.Errorf(codes.InvalidArgument, "Could not prepare block")
if err != nil { | ||
return &emptypb.Empty{}, status.Errorf(codes.Internal, "Could not get proto block: %v", err) | ||
} | ||
_, err = bs.V1Alpha1ValidatorServer.ProposeBeaconBlock(ctx, ð.GenericSignedBeaconBlock{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When processing SSZ, I avoid calling the helper submitXXX
functions because I already have a v1alpha1 block, and they require a v1/v2 block that they convert to v1alpha1. So that means two unnecessary conversions.
bac45f9
to
caad354
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks for adding the additional fixes
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> # Conflicts: # beacon-chain/rpc/eth/beacon/BUILD.bazel # beacon-chain/rpc/eth/beacon/blinded_blocks_test.go # beacon-chain/rpc/prysm/v1alpha1/validator/proposer.go
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
What type of PR is this?
Other
What does this PR do? Why is it needed?
Inspired by #12319, this PR uses v1alpha1 server for block production and uses a mock server in tests.