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

HTTP API: /eth/v1/beacon/pool/bls_to_execution_changes #12963

Merged
merged 32 commits into from
Oct 11, 2023

Conversation

james-prysm
Copy link
Contributor

@james-prysm james-prysm commented Sep 27, 2023

What type of PR is this?

Feature

What does this PR do? Why is it needed?

implements

  • POST /eth/v1/beacon/pool/bls_to_execution_changes
  • GET /eth/v1/beacon/pool/bls_to_execution_changes

endpoints in full rest and removes the grpc implementation. some of the types must remain for the purposes of execution payload use, we may have a better migration path for these endpoints in the future.

Which issues(s) does this PR fix?

part of #12970

@james-prysm james-prysm changed the title Http bls change HTTP API: /eth/v1/beacon/pool/bls_to_execution_changes Sep 28, 2023
@james-prysm james-prysm self-assigned this Sep 28, 2023
@james-prysm james-prysm added the API Api related tasks label Sep 28, 2023
@james-prysm james-prysm added the Ready For Review A pull request ready for code review label Sep 28, 2023
@james-prysm james-prysm marked this pull request as ready for review September 28, 2023 16:01
@james-prysm james-prysm requested a review from a team as a code owner September 28, 2023 16:01
@@ -87,13 +85,6 @@ func (_ *BeaconEndpointFactory) Create(path string) (*apimiddleware.Endpoint, er
case "/eth/v1/beacon/pool/proposer_slashings":
endpoint.PostRequest = &ProposerSlashingJson{}
endpoint.GetResponse = &ProposerSlashingsPoolResponseJson{}
case "/eth/v1/beacon/pool/bls_to_execution_changes":
endpoint.PostRequest = &SubmitBLSToExecutionChangesRequest{}
endpoint.GetResponse = &BLSToExecutionChangesPoolResponseJson{}
Copy link
Contributor

Choose a reason for hiding this comment

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

BLSToExecutionChangesPoolResponseJson can be removed


// SubmitSignedBLSToExecutionChanges submits said object to the node's pool
// if it passes validation the node must broadcast it to the network.
func (s *Server) SubmitSignedBLSToExecutionChanges(w http.ResponseWriter, r *http.Request) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would simplify the name to SubmitBLSToExecutionChanges because there is no unsigned counterpart

beacon-chain/rpc/eth/beacon/handlers_pool.go Outdated Show resolved Hide resolved
Comment on lines 380 to 391
if len(failures) > 0 {
failuresContainer := &helpers.IndexedVerificationFailure{Failures: failures}
err := grpc.AppendCustomErrorHeader(ctx, failuresContainer)
if err != nil {
http2.HandleError(w, fmt.Sprintf("One or more BLSToExecutionChange failed validation. Could not prepare BLSToExecutionChange failure information: %v",
err), http.StatusBadRequest)
return
}
http2.HandleError(w, fmt.Sprintf("One or more BLSToExecutionChange failed validation: %v",
err), http.StatusBadRequest)
return
}
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 not how it should be done for HTTP. It should be done the same way as when submitting atts:

if len(attFailures) > 0 {
		failuresErr := &shared.IndexedVerificationFailureError{
			Code:     http.StatusBadRequest,
			Message:  "One or more attestations failed validation",
			Failures: attFailures,
		}
		http2.WriteError(w, failuresErr)
}

beacon-chain/rpc/eth/shared/structs.go Outdated Show resolved Hide resolved
beacon-chain/rpc/eth/shared/structs.go Outdated Show resolved Hide resolved
beacon-chain/rpc/eth/shared/structs.go Outdated Show resolved Hide resolved
beacon-chain/rpc/eth/shared/structs.go Outdated Show resolved Hide resolved
@james-prysm james-prysm added OK to merge and removed Ready For Review A pull request ready for code review labels Oct 11, 2023
@prylabs-bulldozer prylabs-bulldozer bot merged commit 55e4c6e into develop Oct 11, 2023
16 of 17 checks passed
@prylabs-bulldozer prylabs-bulldozer bot deleted the http-bls-change branch October 11, 2023 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Api related tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants