mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
keymanager api: lowercase statuses (#13696)
* cleanup * adding test * address small comment * gaz
This commit is contained in:
parent
21775eed52
commit
e49ed4d554
@ -74,13 +74,13 @@ type KeyStatus struct {
|
||||
type KeyStatusType string
|
||||
|
||||
const (
|
||||
StatusImported KeyStatusType = "IMPORTED"
|
||||
StatusError KeyStatusType = "ERROR"
|
||||
StatusDuplicate KeyStatusType = "DUPLICATE"
|
||||
StatusUnknown KeyStatusType = "UNKNOWN"
|
||||
StatusNotFound KeyStatusType = "NOT_FOUND"
|
||||
StatusDeleted KeyStatusType = "DELETED"
|
||||
StatusNotActive KeyStatusType = "NOT_ACTIVE"
|
||||
StatusImported KeyStatusType = "imported"
|
||||
StatusError KeyStatusType = "error"
|
||||
StatusDuplicate KeyStatusType = "duplicate"
|
||||
StatusUnknown KeyStatusType = "unknown"
|
||||
StatusNotFound KeyStatusType = "not_found"
|
||||
StatusDeleted KeyStatusType = "deleted"
|
||||
StatusNotActive KeyStatusType = "not_active"
|
||||
)
|
||||
|
||||
// PublicKeyDeleter allows deleting public keys set in keymanager.
|
||||
|
@ -30,6 +30,7 @@ go_library(
|
||||
"//async/event:go_default_library",
|
||||
"//beacon-chain/rpc/eth/shared:go_default_library",
|
||||
"//cmd:go_default_library",
|
||||
"//cmd/validator/flags:go_default_library",
|
||||
"//config/features:go_default_library",
|
||||
"//config/fieldparams:go_default_library",
|
||||
"//config/params:go_default_library",
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v5/cmd/validator/flags"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/proposer"
|
||||
@ -479,7 +480,7 @@ func (s *Server) ImportRemoteKeys(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
if isUrlUsed {
|
||||
log.Warnf("Setting web3signer base url for IMPORTED keys is not supported. Prysm only uses the url from --validators-external-signer-url flag for web3signerKeymanagerKind.")
|
||||
log.Warnf("Setting the remote signer base url within the request is not supported. The remote signer url can only be set from the --%s flag.", flags.Web3SignerURLFlag.Name)
|
||||
}
|
||||
|
||||
httputil.WriteJson(w, &RemoteKeysResponse{Data: adder.AddPublicKeys(remoteKeys)})
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -204,7 +205,7 @@ func TestServer_ImportKeystores(t *testing.T) {
|
||||
resp := &ImportKeystoresResponse{}
|
||||
require.NoError(t, json.Unmarshal(wr.Body.Bytes(), resp))
|
||||
require.Equal(t, 2, len(resp.Data))
|
||||
require.Equal(t, keymanager.StatusError, resp.Data[0].Status)
|
||||
require.Equal(t, fmt.Sprintf("%v", keymanager.StatusError), strings.ToLower(string(resp.Data[0].Status))) // make sure it's lower case
|
||||
})
|
||||
t.Run("200 response even if number of passwords does not match number of keystores", func(t *testing.T) {
|
||||
request := &ImportKeystoresRequest{
|
||||
@ -1406,6 +1407,7 @@ func TestServer_ImportRemoteKeys(t *testing.T) {
|
||||
require.NoError(t, json.Unmarshal(w.Body.Bytes(), resp))
|
||||
for i := 0; i < len(resp.Data); i++ {
|
||||
require.DeepEqual(t, expectedStatuses[i], resp.Data[i])
|
||||
require.Equal(t, fmt.Sprintf("%v", expectedStatuses[i].Status), strings.ToLower(string(resp.Data[i].Status)))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user