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 endpoint for GetValidatorActiveSetChanges #14264

Merged
merged 10 commits into from
Aug 6, 2024
Merged

Conversation

saolyn
Copy link
Contributor

@saolyn saolyn commented Jul 25, 2024

What type of PR is this?

Other

What does this PR do? Why is it needed?

Adding the HTTP endpoint for GetValidatorActiveSetChanges.
Same changes done here as to #14261

Which issues(s) does this PR fix?

N/A

Other notes for review

@saolyn saolyn requested a review from rkapka July 25, 2024 16:12
@saolyn saolyn requested a review from a team as a code owner July 25, 2024 16:12
template: "/prysm/v1/validators/active_set_changes",
name: namespace + ".GetValidatorActiveSetChanges",
middleware: []mux.MiddlewareFunc{
middleware.ContentTypeHandler([]string{api.JsonMediaType}),
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't need the content type handler for a get request

@saolyn saolyn added the API Api related tasks label Aug 2, 2024
@@ -1087,5 +1088,14 @@ func (*Service) prysmValidatorEndpoints(coreService *core.Service) []endpoint {
handler: server.GetValidatorPerformance,
methods: []string{http.MethodPost},
},
{
template: "/prysm/v1/validators/active_set_changes",
name: namespace + ".GetValidatorActiveSetChanges",
Copy link
Contributor

Choose a reason for hiding this comment

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

One small nitpick: since the namespace is prysm.validator, there is no need to repeat the word Validator in every handler. Can you remove it from this one and all the other existing ones?

httputil.WriteJson(w, response)
}

func byteArrayToString(byteArrays [][]byte) []string {
Copy link
Contributor

Choose a reason for hiding this comment

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

To be precise, this should be named byteSlice2dToStringSlice because:

  • arrays are fixed-length
  • we have a slice of slices
  • the result is not a string, but a slice of strings

return s
}

func uint64ArrayToString(indices []primitives.ValidatorIndex) []string {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should technically be named uint64SliceToStringSlice

@rkapka rkapka added this pull request to the merge queue Aug 6, 2024
Merged via the queue into develop with commit e0785a8 Aug 6, 2024
16 of 17 checks passed
@rkapka rkapka deleted the http-active-set-changes branch August 6, 2024 12:20
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.

3 participants