POST version of GetValidators and GetValidatorBalances#13199
Merged
prylabs-bulldozer[bot] merged 7 commits intodevelopfrom Nov 22, 2023
Merged
POST version of GetValidators and GetValidatorBalances#13199prylabs-bulldozer[bot] merged 7 commits intodevelopfrom
prylabs-bulldozer[bot] merged 7 commits intodevelopfrom
Conversation
james-prysm
reviewed
Nov 17, 2023
| if r.Method == http.MethodGet { | ||
| rawIds = r.URL.Query()["id"] | ||
| } else { | ||
| err = json.NewDecoder(r.Body).Decode(&rawIds) |
Contributor
There was a problem hiding this comment.
I saw the spec and this list should be a unique list of IDs, i don't think decodeIds is checking for uniqueness.
Contributor
Author
There was a problem hiding this comment.
I don't see it anywhere in the spec. It is a useful thing to add, but I would prefer to have it in another PR.
nalepae
previously approved these changes
Nov 22, 2023
|
|
||
| statuses := r.URL.Query()["status"] | ||
| var statuses []string | ||
| if r.Method == http.MethodGet { |
Contributor
There was a problem hiding this comment.
Maybe grouping rawIds and statuses to reduce the number of r.Method == http.MethodGet?
(Not sure what is the most idiomatic in that case.)
Like:
var rawIds []string
var statuses []string
if r.Method == http.MethodGet {
rawIds = r.URL.Query()["id"]
statuses = r.URL.Query()["status"]
} else {
rawIds = req.Ids
statuses = req.Statuses
}| if r.Method == http.MethodPost { | ||
| err = json.NewDecoder(r.Body).Decode(&req) | ||
| switch { | ||
| case err == io.EOF: |
Contributor
There was a problem hiding this comment.
Those errors case seem not to be tested.
(Not sure about the testing policy in that case.)
| } else { | ||
| err = json.NewDecoder(r.Body).Decode(&rawIds) | ||
| switch { | ||
| case err == io.EOF: |
Contributor
There was a problem hiding this comment.
Those errors case seem not to be tested.
(Not sure about the testing policy in that case.)
nalepae
approved these changes
Nov 22, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Feature
What does this PR do? Why is it needed?
Implements ethereum/beacon-APIs#367. I also simplified testing to use less validators.
Which issues(s) does this PR fix?
Fixes #13187