Skip to content

Commit 86fcd49

Browse files
committed
Use post instead of get to fetch validators
1 parent c008706 commit 86fcd49

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

shared/services/beacon/client/std-http-client.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ func (c *StandardHttpClient) GetValidatorStatuses(pubkeys []types.ValidatorPubke
441441

442442
// Get whether validators have sync duties to perform at given epoch
443443
func (c *StandardHttpClient) GetValidatorSyncDuties(indices []string, epoch uint64) (map[string]bool, error) {
444-
// Return if there are not validators to check
444+
// Return if there are no validators to check
445445
if len(indices) == 0 {
446446
return nil, nil
447447
}
@@ -859,11 +859,14 @@ func (c *StandardHttpClient) getValidatorBalances(stateId string, indices []stri
859859

860860
// Get validators
861861
func (c *StandardHttpClient) getValidators(stateId string, pubkeys []string) (ValidatorsResponse, error) {
862-
var query string
863-
if len(pubkeys) > 0 {
864-
query = fmt.Sprintf("?id=%s", strings.Join(pubkeys, ","))
862+
863+
// Build the post body matching the Beacon API spec:
864+
// { "ids": ["pubkey1", "pubkey2", ...], "statuses": [] }
865+
postBody := map[string][]string{
866+
"ids": pubkeys,
867+
"statuses": []string{},
865868
}
866-
responseBody, status, err := c.getRequest(fmt.Sprintf(RequestValidatorsPath, stateId) + query)
869+
responseBody, status, err := c.postRequest(fmt.Sprintf(RequestValidatorsPath, stateId), postBody)
867870
if err != nil {
868871
return ValidatorsResponse{}, fmt.Errorf("Could not get validators: %w", err)
869872
}

0 commit comments

Comments
 (0)