mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Dynamic key reload for remote keymanager (#8611)
* Dynamic key reload for remote keymanager * fix failing keymanager test * keymanager tests * define RemoteKeymanager interface * WaitForActivation tests * gzl * handle error in test
This commit is contained in:
@@ -6,12 +6,12 @@ import (
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/pkg/errors"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
"github.com/prysmaticlabs/prysm/shared/mock"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/validator/client/testutil"
|
||||
logTest "github.com/sirupsen/logrus/hooks/test"
|
||||
)
|
||||
|
||||
@@ -42,7 +42,7 @@ func TestValidator_HandleKeyReload(t *testing.T) {
|
||||
genesisTime: 1,
|
||||
}
|
||||
|
||||
resp := generateResponse([][]byte{inactivePubKey[:], activePubKey[:]})
|
||||
resp := testutil.GenerateMultipleValidatorStatusResponse([][]byte{inactivePubKey[:], activePubKey[:]})
|
||||
resp.Statuses[0].Status = ethpb.ValidatorStatus_UNKNOWN_STATUS
|
||||
resp.Statuses[1].Status = ethpb.ValidatorStatus_ACTIVE
|
||||
client.EXPECT().MultipleValidatorStatus(
|
||||
@@ -78,7 +78,7 @@ func TestValidator_HandleKeyReload(t *testing.T) {
|
||||
genesisTime: 1,
|
||||
}
|
||||
|
||||
resp := generateResponse([][]byte{inactivePubKey[:]})
|
||||
resp := testutil.GenerateMultipleValidatorStatusResponse([][]byte{inactivePubKey[:]})
|
||||
resp.Statuses[0].Status = ethpb.ValidatorStatus_UNKNOWN_STATUS
|
||||
client.EXPECT().MultipleValidatorStatus(
|
||||
gomock.Any(),
|
||||
@@ -122,20 +122,3 @@ func TestValidator_HandleKeyReload(t *testing.T) {
|
||||
assert.ErrorContains(t, "error", err)
|
||||
})
|
||||
}
|
||||
|
||||
func generateResponse(pubkeys [][]byte) *ethpb.MultipleValidatorStatusResponse {
|
||||
resp := ðpb.MultipleValidatorStatusResponse{
|
||||
PublicKeys: make([][]byte, len(pubkeys)),
|
||||
Statuses: make([]*ethpb.ValidatorStatusResponse, len(pubkeys)),
|
||||
Indices: make([]types.ValidatorIndex, len(pubkeys)),
|
||||
}
|
||||
for i, key := range pubkeys {
|
||||
resp.PublicKeys[i] = key
|
||||
resp.Statuses[i] = ðpb.ValidatorStatusResponse{
|
||||
Status: ethpb.ValidatorStatus_UNKNOWN_STATUS,
|
||||
}
|
||||
resp.Indices[i] = types.ValidatorIndex(i)
|
||||
}
|
||||
|
||||
return resp
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user