Massive code cleanup (#10913)

* Massive code cleanup

* fix test issues

* remove GetGenesis mock expectations

* unused receiver

* rename unused params

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Radosław Kapka
2022-06-27 15:34:38 +02:00
committed by GitHub
parent 9216be7d43
commit 7f56ac6355
158 changed files with 1020 additions and 1177 deletions

View File

@@ -108,9 +108,9 @@ func TestClient_Sign_400(t *testing.T) {
func TestClient_GetPublicKeys_HappyPath(t *testing.T) {
// public keys are returned hex encoded with 0x
json := `["0xa2b5aaad9c6efefe7bb9b1243a043404f3362937cfb6b31833929833173f476630ea2cfeb0d9ddf15f97ca8685948820"]`
j := `["0xa2b5aaad9c6efefe7bb9b1243a043404f3362937cfb6b31833929833173f476630ea2cfeb0d9ddf15f97ca8685948820"]`
// create a new reader with that JSON
r := io.NopCloser(bytes.NewReader([]byte(json)))
r := io.NopCloser(bytes.NewReader([]byte(j)))
mock := &mockTransport{mockResponse: &http.Response{
StatusCode: 200,
Body: r,
@@ -127,9 +127,9 @@ func TestClient_GetPublicKeys_HappyPath(t *testing.T) {
func TestClient_GetPublicKeys_EncodingError(t *testing.T) {
// public keys are returned hex encoded with 0x
json := `["a2b5aaad9c6efefe7bb9b1243a043404f3362937c","fb6b31833929833173f476630ea2cfe","b0d9ddf15fca8685948820"]`
j := `["a2b5aaad9c6efefe7bb9b1243a043404f3362937c","fb6b31833929833173f476630ea2cfe","b0d9ddf15fca8685948820"]`
// create a new reader with that JSON
r := io.NopCloser(bytes.NewReader([]byte(json)))
r := io.NopCloser(bytes.NewReader([]byte(j)))
mock := &mockTransport{mockResponse: &http.Response{
StatusCode: 200,
Body: r,
@@ -157,8 +157,8 @@ func TestClient_ReloadSignerKeys_HappyPath(t *testing.T) {
// TODO: not really in use, should be revisited
func TestClient_GetServerStatus_HappyPath(t *testing.T) {
json := `"some server status, not sure what it looks like, need to find some sample data"`
r := io.NopCloser(bytes.NewReader([]byte(json)))
j := `"some server status, not sure what it looks like, need to find some sample data"`
r := io.NopCloser(bytes.NewReader([]byte(j)))
mock := &mockTransport{mockResponse: &http.Response{
StatusCode: 200,
Body: r,

View File

@@ -18,7 +18,7 @@ import (
ethpbservice "github.com/prysmaticlabs/prysm/proto/eth/service"
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
"github.com/prysmaticlabs/prysm/validator/keymanager"
remote_utils "github.com/prysmaticlabs/prysm/validator/keymanager/remote-utils"
remoteutils "github.com/prysmaticlabs/prysm/validator/keymanager/remote-utils"
"github.com/prysmaticlabs/prysm/validator/keymanager/remote-web3signer/internal"
web3signerv1 "github.com/prysmaticlabs/prysm/validator/keymanager/remote-web3signer/v1"
log "github.com/sirupsen/logrus"
@@ -250,7 +250,7 @@ func (km *Keymanager) SubscribeAccountChanges(pubKeysChan chan [][fieldparams.BL
// ExtractKeystores is not supported for the remote-web3signer keymanager type.
func (*Keymanager) ExtractKeystores(
ctx context.Context, publicKeys []bls.PublicKey, password string,
_ context.Context, _ []bls.PublicKey, _ string,
) ([]*keymanager.Keystore, error) {
return nil, errors.New("extracting keys is not supported for a web3signer keymanager")
}
@@ -283,7 +283,7 @@ func (km *Keymanager) ListKeymanagerAccounts(ctx context.Context, cfg keymanager
} else {
fmt.Printf("Showing %d validator accounts\n", len(validatingPubKeys))
}
remote_utils.DisplayRemotePublicKeys(validatingPubKeys)
remoteutils.DisplayRemotePublicKeys(validatingPubKeys)
return nil
}