A bit of cleanup based on goconst tool (#8529)

* Make 1 occurence of 'foo', 'bar' and 'fizz!'

* Make 1 occurence of 'merkleizing list that is too large, over limit' string

* Limit password occurrences

* Make only 1 occurence of 'strongPass'

* Limit testMnemonic occurrences

* Limit expected epoch error messages

* Rename errors and use constant

* Update bazel dependencies

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
Panagiotis Georgiadis
2021-03-02 12:39:54 +01:00
committed by GitHub
parent b3dcbfe2a4
commit 46f6bd6d08
21 changed files with 68 additions and 68 deletions

View File

@@ -14,6 +14,8 @@ import (
"google.golang.org/grpc/status"
)
const errEpoch = "Cannot retrieve information about an epoch in the future, current epoch %d, requesting %d"
// ListValidatorAssignments retrieves the validator assignments for a given epoch,
// optional validator indices or public keys may be included to filter validator assignments.
func (bs *Server) ListValidatorAssignments(
@@ -45,7 +47,7 @@ func (bs *Server) ListValidatorAssignments(
if requestedEpoch > currentEpoch {
return nil, status.Errorf(
codes.InvalidArgument,
"Cannot retrieve information about an epoch in the future, current epoch %d, requesting %d",
errEpoch,
currentEpoch,
requestedEpoch,
)

View File

@@ -30,7 +30,7 @@ func TestServer_ListAssignments_CannotRequestFutureEpoch(t *testing.T) {
GenesisTimeFetcher: &mock.ChainService{},
}
wanted := "Cannot retrieve information about an epoch in the future"
wanted := errNoEpochInfoError
_, err := bs.ListValidatorAssignments(
ctx,
&ethpb.ListValidatorAssignmentsRequest{

View File

@@ -55,7 +55,7 @@ func (bs *Server) ListValidatorBalances(
if requestedEpoch > currentEpoch {
return nil, status.Errorf(
codes.InvalidArgument,
"Cannot retrieve information about an epoch in the future, current epoch %d, requesting %d",
errEpoch,
currentEpoch,
requestedEpoch,
)
@@ -207,7 +207,7 @@ func (bs *Server) ListValidators(
if q.Epoch > currentEpoch {
return nil, status.Errorf(
codes.InvalidArgument,
"Cannot retrieve information about an epoch in the future, current epoch %d, requesting %d",
errEpoch,
currentEpoch,
q.Epoch,
)
@@ -401,7 +401,7 @@ func (bs *Server) GetValidatorActiveSetChanges(
if requestedEpoch > currentEpoch {
return nil, status.Errorf(
codes.InvalidArgument,
"Cannot retrieve information about an epoch in the future, current epoch %d, requesting %d",
errEpoch,
currentEpoch,
requestedEpoch,
)
@@ -775,7 +775,7 @@ func (bs *Server) GetIndividualVotes(
if req.Epoch > currentEpoch {
return nil, status.Errorf(
codes.InvalidArgument,
"Cannot retrieve information about an epoch in the future, current epoch %d, requesting %d",
errEpoch,
currentEpoch,
req.Epoch,
)

View File

@@ -32,6 +32,10 @@ import (
"github.com/prysmaticlabs/prysm/shared/timeutils"
)
const (
errNoEpochInfoError = "Cannot retrieve information about an epoch in the future"
)
func TestServer_GetValidatorActiveSetChanges_CannotRequestFutureEpoch(t *testing.T) {
beaconDB := dbTest.SetupDB(t)
ctx := context.Background()
@@ -46,7 +50,7 @@ func TestServer_GetValidatorActiveSetChanges_CannotRequestFutureEpoch(t *testing
BeaconDB: beaconDB,
}
wanted := "Cannot retrieve information about an epoch in the future"
wanted := errNoEpochInfoError
_, err = bs.GetValidatorActiveSetChanges(
ctx,
&ethpb.GetValidatorActiveSetChangesRequest{
@@ -73,7 +77,7 @@ func TestServer_ListValidatorBalances_CannotRequestFutureEpoch(t *testing.T) {
GenesisTimeFetcher: &mock.ChainService{},
}
wanted := "Cannot retrieve information about an epoch in the future"
wanted := errNoEpochInfoError
_, err = bs.ListValidatorBalances(
ctx,
&ethpb.ListValidatorBalancesRequest{
@@ -415,7 +419,7 @@ func TestServer_ListValidators_CannotRequestFutureEpoch(t *testing.T) {
},
}
wanted := "Cannot retrieve information about an epoch in the future"
wanted := errNoEpochInfoError
_, err = bs.ListValidators(
ctx,
&ethpb.ListValidatorsRequest{
@@ -1916,7 +1920,7 @@ func TestServer_GetIndividualVotes_RequestFutureSlot(t *testing.T) {
req := &ethpb.IndividualVotesRequest{
Epoch: helpers.SlotToEpoch(ds.GenesisTimeFetcher.CurrentSlot()) + 1,
}
wanted := "Cannot retrieve information about an epoch in the future"
wanted := errNoEpochInfoError
_, err := ds.GetIndividualVotes(context.Background(), req)
assert.ErrorContains(t, wanted, err)
}

View File

@@ -10,6 +10,8 @@ import (
"github.com/prysmaticlabs/prysm/shared/testutil/require"
)
const merkleizingListLimitError = "merkleizing list that is too large, over limit"
func TestBitlistRoot(t *testing.T) {
hasher := hashutil.CustomSHA256Hasher()
capacity := uint64(10)
@@ -44,10 +46,9 @@ func TestBitwiseMerkleizeOverLimit(t *testing.T) {
}
count := uint64(2)
limit := uint64(1)
expected := "merkleizing list that is too large, over limit"
_, err := htrutils.BitwiseMerkleize(hasher, chunks, count, limit)
assert.ErrorContains(t, expected, err)
assert.ErrorContains(t, merkleizingListLimitError, err)
}
func TestBitwiseMerkleizeArrays(t *testing.T) {
@@ -73,10 +74,9 @@ func TestBitwiseMerkleizeArraysOverLimit(t *testing.T) {
}
count := uint64(2)
limit := uint64(1)
expected := "merkleizing list that is too large, over limit"
_, err := htrutils.BitwiseMerkleizeArrays(hasher, chunks, count, limit)
assert.ErrorContains(t, expected, err)
assert.ErrorContains(t, merkleizingListLimitError, err)
}
func TestPack(t *testing.T) {

View File

@@ -312,15 +312,15 @@ func TestSyncCondCompatibility(t *testing.T) {
var wg sync.WaitGroup
wg.Add(2)
cond := sync.NewCond(NewMultilock("A", "C"))
sharedRsc := "foo"
var testValues = [3]string{"foo", "bar", "fizz!"}
sharedRsc := testValues[0]
go func() {
cond.L.Lock()
for sharedRsc == "foo" {
for sharedRsc == testValues[0] {
cond.Wait()
}
sharedRsc = "fizz!"
sharedRsc = testValues[2]
cond.Broadcast()
cond.L.Unlock()
wg.Done()
@@ -328,9 +328,9 @@ func TestSyncCondCompatibility(t *testing.T) {
go func() {
cond.L.Lock()
sharedRsc = "bar"
sharedRsc = testValues[1]
cond.Broadcast()
for sharedRsc == "bar" {
for sharedRsc == testValues[1] {
cond.Wait()
}
cond.L.Unlock()
@@ -338,5 +338,5 @@ func TestSyncCondCompatibility(t *testing.T) {
}()
wg.Wait()
assert.Equal(t, "fizz!", sharedRsc)
assert.Equal(t, testValues[2], sharedRsc)
}

View File

@@ -20,6 +20,8 @@ import (
keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4"
)
const password = "secretPassw0rd$1999"
type cliConfig struct {
keystoresPath string
password string
@@ -70,7 +72,6 @@ func setupRandomDir(t testing.TB) string {
func TestDecrypt(t *testing.T) {
keystoresDir := setupRandomDir(t)
password := "secretPassw0rd$1999"
keystore, privKey := createRandomKeystore(t, password)
// We write a random keystore to a keystores directory.
encodedKeystore, err := json.MarshalIndent(keystore, "", "\t")
@@ -109,7 +110,6 @@ func TestDecrypt(t *testing.T) {
func TestEncrypt(t *testing.T) {
keystoresDir := setupRandomDir(t)
password := "secretPassw0rd$1999"
keystoreFilePath := filepath.Join(keystoresDir, "keystore.json")
privKey, err := bls.RandKey()
require.NoError(t, err)

View File

@@ -94,6 +94,7 @@ go_test(
"//validator/keymanager/derived:go_default_library",
"//validator/keymanager/imported:go_default_library",
"//validator/keymanager/remote:go_default_library",
"//validator/testing:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",
"@com_github_golang_mock//gomock:go_default_library",
"@com_github_google_uuid//:go_default_library",

View File

@@ -4,6 +4,7 @@ import (
"archive/zip"
"encoding/hex"
"encoding/json"
constant "github.com/prysmaticlabs/prysm/validator/testing"
"io/ioutil"
"os"
"path/filepath"
@@ -22,10 +23,6 @@ import (
"github.com/prysmaticlabs/prysm/validator/keymanager/derived"
)
var (
testMnemonic = "tumble turn jewel sudden social great water general cabin jacket bounce dry flip monster advance problem social half flee inform century chicken hard reason"
)
func TestBackupAccounts_Noninteractive_Derived(t *testing.T) {
walletDir, _, passwordFilePath := setupWalletAndPasswordsDir(t)
// Specify the password locally to this file for convenience.
@@ -69,7 +66,7 @@ func TestBackupAccounts_Noninteractive_Derived(t *testing.T) {
// Create 2 accounts
derivedKM, ok := km.(*derived.Keymanager)
require.Equal(t, true, ok)
err = derivedKM.RecoverAccountsFromMnemonic(cliCtx.Context, testMnemonic, "", 2)
err = derivedKM.RecoverAccountsFromMnemonic(cliCtx.Context, constant.TestMnemonic, "", 2)
require.NoError(t, err)
// Obtain the public keys of the accounts we created

View File

@@ -3,6 +3,7 @@ package accounts
import (
"context"
"fmt"
constant "github.com/prysmaticlabs/prysm/validator/testing"
"io/ioutil"
"math"
"os"
@@ -249,7 +250,7 @@ func TestListAccounts_DerivedKeymanager(t *testing.T) {
require.NoError(t, err)
numAccounts := 5
err = keymanager.RecoverAccountsFromMnemonic(cliCtx.Context, testMnemonic, "", numAccounts)
err = keymanager.RecoverAccountsFromMnemonic(cliCtx.Context, constant.TestMnemonic, "", numAccounts)
require.NoError(t, err)
rescueStdout := os.Stdout

View File

@@ -3,6 +3,7 @@ package client
import (
"context"
"fmt"
constant "github.com/prysmaticlabs/prysm/validator/testing"
"testing"
"time"
@@ -304,8 +305,7 @@ func TestWaitForActivation_AccountsChanged(t *testing.T) {
})
t.Run("Derived keymanager", func(t *testing.T) {
mnemonic := "tumble turn jewel sudden social great water general cabin jacket bounce dry flip monster advance problem social half flee inform century chicken hard reason"
seed := bip39.NewSeed(mnemonic, "")
seed := bip39.NewSeed(constant.TestMnemonic, "")
inactivePrivKey, err :=
util.PrivateKeyFromSeedAndPath(seed, fmt.Sprintf(derived.ValidatingKeyDerivationPathTemplate, 0))
require.NoError(t, err)
@@ -327,7 +327,7 @@ func TestWaitForActivation_AccountsChanged(t *testing.T) {
ListenForChanges: true,
})
require.NoError(t, err)
err = km.RecoverAccountsFromMnemonic(ctx, mnemonic, "", 1)
err = km.RecoverAccountsFromMnemonic(ctx, constant.TestMnemonic, "", 1)
require.NoError(t, err)
client := mock.NewMockBeaconNodeValidatorClient(ctrl)
v := validator{
@@ -369,7 +369,7 @@ func TestWaitForActivation_AccountsChanged(t *testing.T) {
go func() {
// We add the active key into the keymanager and simulate a key refresh.
time.Sleep(time.Second * 1)
err = km.RecoverAccountsFromMnemonic(ctx, mnemonic, "", 2)
err = km.RecoverAccountsFromMnemonic(ctx, constant.TestMnemonic, "", 2)
require.NoError(t, err)
channel <- struct{}{}
}()

View File

@@ -41,6 +41,7 @@ go_test(
"//shared/testutil/assert:go_default_library",
"//shared/testutil/require:go_default_library",
"//validator/accounts/testing:go_default_library",
"//validator/testing:go_default_library",
"@com_github_tyler_smith_go_bip39//:go_default_library",
"@com_github_wealdtech_go_eth2_util//:go_default_library",
],

View File

@@ -3,6 +3,7 @@ package derived
import (
"context"
"fmt"
constant "github.com/prysmaticlabs/prysm/validator/testing"
"testing"
validatorpb "github.com/prysmaticlabs/prysm/proto/validator/accounts/v2"
@@ -15,15 +16,18 @@ import (
util "github.com/wealdtech/go-eth2-util"
)
const (
password = "secretPassw0rd$1999"
)
// We test that using a '25th word' mnemonic passphrase leads to different
// public keys derived than not specifying the passphrase.
func TestDerivedKeymanager_MnemnonicPassphrase_DifferentResults(t *testing.T) {
sampleMnemonic := "tumble turn jewel sudden social great water general cabin jacket bounce dry flip monster advance problem social half flee inform century chicken hard reason"
ctx := context.Background()
wallet := &mock.Wallet{
Files: make(map[string]map[string][]byte),
AccountPasswords: make(map[string]string),
WalletPassword: "secretPassw0rd$1999",
WalletPassword: password,
}
km, err := NewKeymanager(ctx, &SetupConfig{
Wallet: wallet,
@@ -31,14 +35,14 @@ func TestDerivedKeymanager_MnemnonicPassphrase_DifferentResults(t *testing.T) {
})
require.NoError(t, err)
numAccounts := 5
err = km.RecoverAccountsFromMnemonic(ctx, sampleMnemonic, "mnemonicpass", numAccounts)
err = km.RecoverAccountsFromMnemonic(ctx, constant.TestMnemonic, "mnemonicpass", numAccounts)
require.NoError(t, err)
without25thWord, err := km.FetchValidatingPublicKeys(ctx)
require.NoError(t, err)
wallet = &mock.Wallet{
Files: make(map[string]map[string][]byte),
AccountPasswords: make(map[string]string),
WalletPassword: "secretPassw0rd$1999",
WalletPassword: password,
}
km, err = NewKeymanager(ctx, &SetupConfig{
Wallet: wallet,
@@ -46,7 +50,7 @@ func TestDerivedKeymanager_MnemnonicPassphrase_DifferentResults(t *testing.T) {
})
require.NoError(t, err)
// No mnemonic passphrase this time.
err = km.RecoverAccountsFromMnemonic(ctx, sampleMnemonic, "", numAccounts)
err = km.RecoverAccountsFromMnemonic(ctx, constant.TestMnemonic, "", numAccounts)
require.NoError(t, err)
with25thWord, err := km.FetchValidatingPublicKeys(ctx)
require.NoError(t, err)
@@ -72,13 +76,12 @@ func TestDerivedKeymanager_RecoverSeedRoundTrip(t *testing.T) {
}
func TestDerivedKeymanager_FetchValidatingPublicKeys(t *testing.T) {
sampleMnemonic := "tumble turn jewel sudden social great water general cabin jacket bounce dry flip monster advance problem social half flee inform century chicken hard reason"
derivedSeed, err := seedFromMnemonic(sampleMnemonic, "")
derivedSeed, err := seedFromMnemonic(constant.TestMnemonic, "")
require.NoError(t, err)
wallet := &mock.Wallet{
Files: make(map[string]map[string][]byte),
AccountPasswords: make(map[string]string),
WalletPassword: "secretPassw0rd$1999",
WalletPassword: password,
}
ctx := context.Background()
dr, err := NewKeymanager(ctx, &SetupConfig{
@@ -87,7 +90,7 @@ func TestDerivedKeymanager_FetchValidatingPublicKeys(t *testing.T) {
})
require.NoError(t, err)
numAccounts := 5
err = dr.RecoverAccountsFromMnemonic(ctx, sampleMnemonic, "", numAccounts)
err = dr.RecoverAccountsFromMnemonic(ctx, constant.TestMnemonic, "", numAccounts)
require.NoError(t, err)
// Fetch the public keys.
@@ -112,13 +115,12 @@ func TestDerivedKeymanager_FetchValidatingPublicKeys(t *testing.T) {
}
func TestDerivedKeymanager_FetchValidatingPrivateKeys(t *testing.T) {
sampleMnemonic := "tumble turn jewel sudden social great water general cabin jacket bounce dry flip monster advance problem social half flee inform century chicken hard reason"
derivedSeed, err := seedFromMnemonic(sampleMnemonic, "")
derivedSeed, err := seedFromMnemonic(constant.TestMnemonic, "")
require.NoError(t, err)
wallet := &mock.Wallet{
Files: make(map[string]map[string][]byte),
AccountPasswords: make(map[string]string),
WalletPassword: "secretPassw0rd$1999",
WalletPassword: password,
}
ctx := context.Background()
dr, err := NewKeymanager(ctx, &SetupConfig{
@@ -127,7 +129,7 @@ func TestDerivedKeymanager_FetchValidatingPrivateKeys(t *testing.T) {
})
require.NoError(t, err)
numAccounts := 5
err = dr.RecoverAccountsFromMnemonic(ctx, sampleMnemonic, "", numAccounts)
err = dr.RecoverAccountsFromMnemonic(ctx, constant.TestMnemonic, "", numAccounts)
require.NoError(t, err)
// Fetch the private keys.
@@ -152,11 +154,10 @@ func TestDerivedKeymanager_FetchValidatingPrivateKeys(t *testing.T) {
}
func TestDerivedKeymanager_Sign(t *testing.T) {
sampleMnemonic := "tumble turn jewel sudden social great water general cabin jacket bounce dry flip monster advance problem social half flee inform century chicken hard reason"
wallet := &mock.Wallet{
Files: make(map[string]map[string][]byte),
AccountPasswords: make(map[string]string),
WalletPassword: "secretPassw0rd$1999",
WalletPassword: password,
}
ctx := context.Background()
dr, err := NewKeymanager(ctx, &SetupConfig{
@@ -165,7 +166,7 @@ func TestDerivedKeymanager_Sign(t *testing.T) {
})
require.NoError(t, err)
numAccounts := 5
err = dr.RecoverAccountsFromMnemonic(ctx, sampleMnemonic, "", numAccounts)
err = dr.RecoverAccountsFromMnemonic(ctx, constant.TestMnemonic, "", numAccounts)
require.NoError(t, err)
pubKeys, err := dr.FetchAllValidatingPublicKeys(ctx)

View File

@@ -17,6 +17,8 @@ import (
keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4"
)
const password = "secretPassw0rd$1999"
func createRandomKeystore(t testing.TB, password string) *keymanager.Keystore {
encryptor := keystorev4.New()
id, err := uuid.NewRandom()
@@ -93,7 +95,6 @@ func TestImportedKeymanager_CreateAccountsKeystore_NoDuplicates(t *testing.T) {
}
func TestImportedKeymanager_ImportKeystores(t *testing.T) {
password := "secretPassw0rd$1999"
// Setup the keymanager.
wallet := &mock.Wallet{
Files: make(map[string]map[string][]byte),

View File

@@ -20,7 +20,6 @@ import (
func TestImportedKeymanager_RemoveAccounts(t *testing.T) {
hook := logTest.NewGlobal()
password := "secretPassw0rd$1999"
wallet := &mock.Wallet{
Files: make(map[string]map[string][]byte),
WalletPassword: password,
@@ -70,7 +69,6 @@ func TestImportedKeymanager_RemoveAccounts(t *testing.T) {
}
func TestImportedKeymanager_FetchValidatingPublicKeys(t *testing.T) {
password := "secretPassw0rd$1999"
wallet := &mock.Wallet{
Files: make(map[string]map[string][]byte),
WalletPassword: password,
@@ -109,7 +107,6 @@ func TestImportedKeymanager_FetchValidatingPublicKeys(t *testing.T) {
}
func TestImportedKeymanager_FetchAllValidatingPublicKeys(t *testing.T) {
password := "secretPassw0rd$1999"
wallet := &mock.Wallet{
Files: make(map[string]map[string][]byte),
WalletPassword: password,
@@ -143,7 +140,6 @@ func TestImportedKeymanager_FetchAllValidatingPublicKeys(t *testing.T) {
}
func TestImportedKeymanager_FetchValidatingPrivateKeys(t *testing.T) {
password := "secretPassw0rd$1999"
wallet := &mock.Wallet{
Files: make(map[string]map[string][]byte),
WalletPassword: password,
@@ -178,7 +174,6 @@ func TestImportedKeymanager_FetchValidatingPrivateKeys(t *testing.T) {
}
func TestImportedKeymanager_Sign(t *testing.T) {
password := "secretPassw0rd$1999"
wallet := &mock.Wallet{
Files: make(map[string]map[string][]byte),
AccountPasswords: make(map[string]string),

View File

@@ -93,6 +93,7 @@ go_test(
"//validator/keymanager:go_default_library",
"//validator/keymanager/derived:go_default_library",
"//validator/keymanager/imported:go_default_library",
"//validator/testing:go_default_library",
"@com_github_dgrijalva_jwt_go//:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",
"@com_github_golang_mock//gomock:go_default_library",

View File

@@ -19,18 +19,17 @@ import (
"github.com/prysmaticlabs/prysm/validator/flags"
"github.com/prysmaticlabs/prysm/validator/keymanager"
"github.com/prysmaticlabs/prysm/validator/keymanager/derived"
constant "github.com/prysmaticlabs/prysm/validator/testing"
)
var (
defaultWalletPath = filepath.Join(flags.DefaultValidatorDir(), flags.WalletDefaultDirName)
testMnemonic = "tumble turn jewel sudden social great water general cabin jacket bounce dry flip monster advance problem social half flee inform century chicken hard reason"
)
func TestServer_ListAccounts(t *testing.T) {
ctx := context.Background()
localWalletDir := setupWalletDir(t)
defaultWalletPath = localWalletDir
strongPass := "29384283xasjasd32%%&*@*#*"
// We attempt to create the wallet.
w, err := accounts.CreateWalletWithKeymanager(ctx, &accounts.CreateWalletConfig{
WalletCfg: &wallet.Config{
@@ -51,7 +50,7 @@ func TestServer_ListAccounts(t *testing.T) {
numAccounts := 50
dr, ok := km.(*derived.Keymanager)
require.Equal(t, true, ok)
err = dr.RecoverAccountsFromMnemonic(ctx, testMnemonic, "", numAccounts)
err = dr.RecoverAccountsFromMnemonic(ctx, constant.TestMnemonic, "", numAccounts)
require.NoError(t, err)
resp, err := s.ListAccounts(ctx, &pb.ListAccountsRequest{
PageSize: int32(numAccounts),
@@ -96,7 +95,6 @@ func TestServer_BackupAccounts(t *testing.T) {
ctx := context.Background()
localWalletDir := setupWalletDir(t)
defaultWalletPath = localWalletDir
strongPass := "29384283xasjasd32%%&*@*#*"
// We attempt to create the wallet.
w, err := accounts.CreateWalletWithKeymanager(ctx, &accounts.CreateWalletConfig{
WalletCfg: &wallet.Config{
@@ -117,7 +115,7 @@ func TestServer_BackupAccounts(t *testing.T) {
numAccounts := 50
dr, ok := km.(*derived.Keymanager)
require.Equal(t, true, ok)
err = dr.RecoverAccountsFromMnemonic(ctx, testMnemonic, "", numAccounts)
err = dr.RecoverAccountsFromMnemonic(ctx, constant.TestMnemonic, "", numAccounts)
require.NoError(t, err)
resp, err := s.ListAccounts(ctx, &pb.ListAccountsRequest{
PageSize: int32(numAccounts),

View File

@@ -31,7 +31,6 @@ func TestServer_SignupAndLogin_RoundTrip(t *testing.T) {
localWalletDir := setupWalletDir(t)
defaultWalletPath = localWalletDir
strongPass := "29384283xasjasd32%%&*@*#*"
ss := &Server{
valDB: valDB,
@@ -100,7 +99,6 @@ func TestServer_ChangePassword_Preconditions(t *testing.T) {
localWalletDir := setupWalletDir(t)
defaultWalletPath = localWalletDir
ctx := context.Background()
strongPass := "29384283xasjasd32%%&*@*#*"
ss := &Server{
walletDir: defaultWalletPath,
}

View File

@@ -25,11 +25,12 @@ import (
keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4"
)
const strongPass = "29384283xasjasd32%%&*@*#*"
func TestServer_CreateWallet_Imported(t *testing.T) {
localWalletDir := setupWalletDir(t)
defaultWalletPath = localWalletDir
ctx := context.Background()
strongPass := "29384283xasjasd32%%&*@*#*"
s := &Server{
walletInitializedFeed: new(event.Feed),
walletDir: defaultWalletPath,
@@ -86,7 +87,6 @@ func TestServer_CreateWallet_Derived(t *testing.T) {
localWalletDir := setupWalletDir(t)
defaultWalletPath = localWalletDir
ctx := context.Background()
strongPass := "29384283xasjasd32%%&*@*#*"
s := &Server{
walletInitializedFeed: new(event.Feed),
walletDir: localWalletDir,
@@ -125,7 +125,6 @@ func TestServer_WalletConfig(t *testing.T) {
localWalletDir := setupWalletDir(t)
defaultWalletPath = localWalletDir
ctx := context.Background()
strongPass := "29384283xasjasd32%%&*@*#*"
s := &Server{
walletInitializedFeed: new(event.Feed),
walletDir: defaultWalletPath,
@@ -157,7 +156,6 @@ func TestServer_ImportKeystores_FailedPreconditions_WrongKeymanagerKind(t *testi
localWalletDir := setupWalletDir(t)
defaultWalletPath = localWalletDir
ctx := context.Background()
strongPass := "29384283xasjasd32%%&*@*#*"
w, err := accounts.CreateWalletWithKeymanager(ctx, &accounts.CreateWalletConfig{
WalletCfg: &wallet.Config{
WalletDir: defaultWalletPath,
@@ -181,7 +179,6 @@ func TestServer_ImportKeystores_FailedPreconditions(t *testing.T) {
localWalletDir := setupWalletDir(t)
defaultWalletPath = localWalletDir
ctx := context.Background()
strongPass := "29384283xasjasd32%%&*@*#*"
w, err := accounts.CreateWalletWithKeymanager(ctx, &accounts.CreateWalletConfig{
WalletCfg: &wallet.Config{
WalletDir: defaultWalletPath,
@@ -217,7 +214,6 @@ func TestServer_ImportKeystores_OK(t *testing.T) {
localWalletDir := setupWalletDir(t)
defaultWalletPath = localWalletDir
ctx := context.Background()
strongPass := "29384283xasjasd32%%&*@*#*"
w, err := accounts.CreateWalletWithKeymanager(ctx, &accounts.CreateWalletConfig{
WalletCfg: &wallet.Config{
WalletDir: defaultWalletPath,

View File

@@ -4,6 +4,7 @@ go_library(
name = "go_default_library",
testonly = True,
srcs = [
"constants.go",
"mock_protector.go",
"mock_slasher.go",
"protection_history.go",

View File

@@ -0,0 +1,3 @@
package testing
const TestMnemonic = "tumble turn jewel sudden social great water general cabin jacket bounce dry flip monster advance problem social half flee inform century chicken hard reason"