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

Implement POST get validators endpoint #2840

Closed
3 tasks done
xenowits opened this issue Jan 30, 2024 · 2 comments
Closed
3 tasks done

Implement POST get validators endpoint #2840

xenowits opened this issue Jan 30, 2024 · 2 comments
Assignees
Labels
protocol Protocol Team tickets

Comments

@xenowits
Copy link
Contributor

xenowits commented Jan 30, 2024

🎯 Problem to be solved

A new endpoint has been recently added to the beacon APIs to query validators from the beacon chain

POST /eth/v1/beacon/states/{state_id}/validators

Note that we already have an endpoint for the same purpose of querying validators, but it's a GET that takes in validator pubkeys/indices in a query parameter

GET /eth/v1/beacon/states/{state_id}/validators

🛠️ Proposed solution

Implement the new POST endpoint in core/validatorapi.

This will probably require us to read the bytes in the request body (router.go):

...
func getValidators(p eth2client.ValidatorsProvider) handlerFunc {
	return func(ctx context.Context, params map[string]string, query url.Values, _ contentType, _ []byte) (any, http.Header, error) {
		stateID := params["state_id"]

		resp, err := getValidatorsByID(ctx, p, stateID, getValidatorIDs(query)...)
...

So, one approach might be to:

  1. Read query parameters for validator pubkeys/indices
  2. If no query parameters provided, read request body
  3. If query parameters provided, don't read request body

🧪 Tests

  • Tested by new automated unit/integration/smoke tests
  • Manually tested on core team/canary/test clusters
  • Manually tested on local compose simnet
@github-actions github-actions bot added the protocol Protocol Team tickets label Jan 30, 2024
@dB2510
Copy link
Contributor

dB2510 commented Jan 31, 2024

Hey team! Please add your planning poker estimate with Zenhub @dB2510 @gsora @pinebit @xenowits

obol-bulldozer bot pushed a commit that referenced this issue Feb 5, 2024
Implemented POST get validators endpoint.

category: feature
ticket: #2840
@pinebit
Copy link
Contributor

pinebit commented Feb 6, 2024

Tested

@pinebit pinebit closed this as completed Feb 6, 2024
gsora pushed a commit that referenced this issue Feb 7, 2024
Implemented POST get validators endpoint.

category: feature
ticket: #2840
obol-bulldozer bot pushed a commit that referenced this issue Feb 8, 2024
Cherrypick of #2849.

Needed to avoid serializing the whole validator list on POST `get_validator` requests.

--

Implemented POST get validators endpoint.

category: feature
ticket: #2840
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
protocol Protocol Team tickets
Projects
None yet
Development

No branches or pull requests

3 participants