Skip to content

Commit

Permalink
setupWithKey: Add isSlashingProtectionMinimal argument.
Browse files Browse the repository at this point in the history
The feature addition is located in `validator/client/propose_test.go`.

The rest of this commit consists in tests wrapping.
  • Loading branch information
nalepae committed Dec 22, 2023
1 parent e786329 commit 410c891
Show file tree
Hide file tree
Showing 2 changed files with 192 additions and 177 deletions.
9 changes: 6 additions & 3 deletions validator/client/propose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@ func testKeyFromBytes(t *testing.T, b []byte) keypair {
func setup(t *testing.T) (*validator, *mocks, bls.SecretKey, func()) {
validatorKey, err := bls.RandKey()
require.NoError(t, err)
return setupWithKey(t, validatorKey)
return setupWithKey(t, validatorKey, false)
}

func setupWithKey(t *testing.T, validatorKey bls.SecretKey) (*validator, *mocks, bls.SecretKey, func()) {
// setupWithKey sets up a validator instance with a given key.
// The `isSlashingProtectionMinimal` flag indicates whether the DB should be instantiated with minimal, filesystem
// slashing protection database.
func setupWithKey(t *testing.T, validatorKey bls.SecretKey, isSlashingProtectionMinimal bool) (*validator, *mocks, bls.SecretKey, func()) {
var pubKey [fieldparams.BLSPubkeyLength]byte
copy(pubKey[:], validatorKey.PublicKey().Marshal())
valDB := testing2.SetupDB(t, [][fieldparams.BLSPubkeyLength]byte{pubKey}, false)
valDB := testing2.SetupDB(t, [][fieldparams.BLSPubkeyLength]byte{pubKey}, isSlashingProtectionMinimal)
ctrl := gomock.NewController(t)
m := &mocks{
validatorClient: validatormock.NewMockValidatorClient(ctrl),
Expand Down
Loading

0 comments on commit 410c891

Please sign in to comment.