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

Fix get validator endpoint for empty query parameters #13780

Merged
merged 3 commits into from
Mar 21, 2024

Conversation

james-prysm
Copy link
Contributor

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

Running validator client in rest mode with --enable-beacon-rest-api with the web UI causes the following error
image
This is caused by a poor handling of the query parameters for rest. This PR introduces some fixes.

@james-prysm james-prysm added Bug Something isn't working API Api related tasks Web UI Related to our beautiful Web UI Validator Client labels Mar 20, 2024
@james-prysm james-prysm requested a review from a team as a code owner March 20, 2024 19:26
@james-prysm james-prysm requested a review from nalepae March 20, 2024 19:45
if strings.HasPrefix(key, "0x") {
k, ok := shared.ValidateHex(w, fmt.Sprintf("PublicKeys[%d]", i), key, fieldparams.BLSPubkeyLength)
if !ok {
return
}
pk = bytesutil.SafeCopyBytes(k)
pubkeys = append(pubkeys, bytesutil.SafeCopyBytes(k))
} else {
data, err := base64.StdEncoding.DecodeString(key)
Copy link
Contributor

Choose a reason for hiding this comment

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

This case is not covered by any test.

var pk []byte
if key == "" {
continue
}
if strings.HasPrefix(key, "0x") {
k, ok := shared.ValidateHex(w, fmt.Sprintf("PublicKeys[%d]", i), key, fieldparams.BLSPubkeyLength)
if !ok {
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 case is not covered by any test.

@james-prysm james-prysm added this pull request to the merge queue Mar 21, 2024
Merged via the queue into develop with commit f7f1d24 Mar 21, 2024
16 of 17 checks passed
@james-prysm james-prysm deleted the fix-get-validators branch March 21, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Api related tasks Bug Something isn't working Validator Client Web UI Related to our beautiful Web UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants