From 2f262033590ff1e79373cf4b8a374a06085cb0f3 Mon Sep 17 00:00:00 2001 From: pablomendezroyo Date: Tue, 7 May 2024 17:15:50 +0200 Subject: [PATCH] add todo --- listener/internal/api/validation/GetActiveValidators.go | 5 ++++- listener/internal/api/validation/GetActiveValidators_test.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/listener/internal/api/validation/GetActiveValidators.go b/listener/internal/api/validation/GetActiveValidators.go index c6831c9..e448dca 100644 --- a/listener/internal/api/validation/GetActiveValidators.go +++ b/listener/internal/api/validation/GetActiveValidators.go @@ -35,6 +35,7 @@ func GetActiveValidators(requestsDecoded []types.SignatureRequestDecoded, beacon } // serialize the request body to JSON + // see https://ethereum.github.io/beacon-APIs/#/Beacon/postStateValidators jsonData, err := json.Marshal(struct { Ids []string `json:"ids"` Statuses []string `json:"statuses"` @@ -48,7 +49,8 @@ func GetActiveValidators(requestsDecoded []types.SignatureRequestDecoded, beacon } // configure HTTP client with timeout - client := &http.Client{Timeout: 10 * time.Second} + // TODO: test timeout + client := &http.Client{Timeout: 50 * time.Second} url := fmt.Sprintf("%s/eth/v1/beacon/states/head/validators", url) resp, err := client.Post(url, "application/json", bytes.NewBuffer(jsonData)) if err != nil { @@ -70,6 +72,7 @@ func GetActiveValidators(requestsDecoded []types.SignatureRequestDecoded, beacon } // assuming the server returns a list of active validators in the format expected + // TODO: get data type an unmarshall to that type if err := json.Unmarshal(responseData, &activeValidators); err != nil { fmt.Printf("error unmarshaling response data: %v\n", err) continue diff --git a/listener/internal/api/validation/GetActiveValidators_test.go b/listener/internal/api/validation/GetActiveValidators_test.go index 8486a14..c7416bb 100644 --- a/listener/internal/api/validation/GetActiveValidators_test.go +++ b/listener/internal/api/validation/GetActiveValidators_test.go @@ -9,7 +9,7 @@ import ( func TestGetActiveValidators(t *testing.T) { // Setup the input data beaconNodeUrls := map[string]string{ - "holesky": "https://holesky.infura.io/v3/e6c920580178424bbdf6dde266bfb5bd", + "holesky": "https://test.53650f79ab75c6ff.dyndns.dappnode.io/", } requestsDecoded := []types.SignatureRequestDecoded{