From c456dcdce82d9311228c96997e7489de5b253ab0 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Thu, 26 Nov 2020 09:35:36 -0800 Subject: [PATCH] Replace highest with lowest for signed epoch DB methods (#7965) * Replace highest with lowerest * Update validator/db/kv/attestation_history_v2.go Co-authored-by: Raul Jordan * Update validator/db/kv/attestation_history_v2.go Co-authored-by: Raul Jordan * Invert equality for saveLowestSourceTargetToDB Co-authored-by: Raul Jordan --- validator/db/iface/interface.go | 8 +- validator/db/kv/attestation_history_v2.go | 76 +++++++++---------- .../db/kv/attestation_history_v2_test.go | 68 ++++++++--------- validator/db/kv/db.go | 4 +- validator/db/kv/schema.go | 6 +- .../standard-protection-format/import.go | 38 +++++----- .../standard-protection-format/import_test.go | 20 ++--- 7 files changed, 110 insertions(+), 110 deletions(-) diff --git a/validator/db/iface/interface.go b/validator/db/iface/interface.go index 4b78eac9ec..a5bfa24a70 100644 --- a/validator/db/iface/interface.go +++ b/validator/db/iface/interface.go @@ -27,10 +27,10 @@ type ValidatorDB interface { ProposedPublicKeys(ctx context.Context) ([][48]byte, error) // Attester protection related methods. - HighestSignedTargetEpoch(ctx context.Context, publicKey [48]byte) (uint64, error) - HighestSignedSourceEpoch(ctx context.Context, publicKey [48]byte) (uint64, error) - SaveHighestSignedTargetEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error - SaveHighestSignedSourceEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error + LowestSignedTargetEpoch(ctx context.Context, publicKey [48]byte) (uint64, error) + LowestSignedSourceEpoch(ctx context.Context, publicKey [48]byte) (uint64, error) + SaveLowestSignedTargetEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error + SaveLowestSignedSourceEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error AttestationHistoryForPubKeysV2(ctx context.Context, publicKeys [][48]byte) (map[[48]byte]kv.EncHistoryData, error) SaveAttestationHistoryForPubKeysV2(ctx context.Context, historyByPubKeys map[[48]byte]kv.EncHistoryData) error SaveAttestationHistoryForPubKeyV2(ctx context.Context, pubKey [48]byte, history kv.EncHistoryData) error diff --git a/validator/db/kv/attestation_history_v2.go b/validator/db/kv/attestation_history_v2.go index 204ad1df37..05a158e407 100644 --- a/validator/db/kv/attestation_history_v2.go +++ b/validator/db/kv/attestation_history_v2.go @@ -89,63 +89,63 @@ func (store *Store) SaveAttestationHistoryForPubKeyV2(ctx context.Context, pubKe return err } -// HighestSignedSourceEpoch returns the highest signed source epoch for a validator public key. +// LowestSignedSourceEpoch returns the lowest signed source epoch for a validator public key. // If no data exists, returning 0 is a sensible default. -func (store *Store) HighestSignedSourceEpoch(ctx context.Context, publicKey [48]byte) (uint64, error) { - ctx, span := trace.StartSpan(ctx, "Validator.HighestSignedSourceEpoch") +func (store *Store) LowestSignedSourceEpoch(ctx context.Context, publicKey [48]byte) (uint64, error) { + ctx, span := trace.StartSpan(ctx, "Validator.LowestSignedSourceEpoch") defer span.End() var err error - var highestSignedSourceEpoch uint64 + var lowestSignedSourceEpoch uint64 err = store.view(func(tx *bolt.Tx) error { - bucket := tx.Bucket(highestSignedSourceBucket) - highestSignedSourceBytes := bucket.Get(publicKey[:]) + bucket := tx.Bucket(lowestSignedSourceBucket) + lowestSignedSourceBytes := bucket.Get(publicKey[:]) // 8 because bytesutil.BytesToUint64BigEndian will return 0 if input is less than 8 bytes. - if len(highestSignedSourceBytes) < 8 { + if len(lowestSignedSourceBytes) < 8 { return nil } - highestSignedSourceEpoch = bytesutil.BytesToUint64BigEndian(highestSignedSourceBytes) + lowestSignedSourceEpoch = bytesutil.BytesToUint64BigEndian(lowestSignedSourceBytes) return nil }) - return highestSignedSourceEpoch, err + return lowestSignedSourceEpoch, err } -// HighestSignedTargetEpoch returns the highest signed target epoch for a validator public key. +// LowestSignedTargetEpoch returns the lowest signed target epoch for a validator public key. // If no data exists, returning 0 is a sensible default. -func (store *Store) HighestSignedTargetEpoch(ctx context.Context, publicKey [48]byte) (uint64, error) { - ctx, span := trace.StartSpan(ctx, "Validator.HighestSignedTargetEpoch") +func (store *Store) LowestSignedTargetEpoch(ctx context.Context, publicKey [48]byte) (uint64, error) { + ctx, span := trace.StartSpan(ctx, "Validator.LowestSignedTargetEpoch") defer span.End() var err error - var highestSignedTargetEpoch uint64 + var lowestSignedTargetEpoch uint64 err = store.view(func(tx *bolt.Tx) error { - bucket := tx.Bucket(highestSignedTargetBucket) - highestSignedTargetBytes := bucket.Get(publicKey[:]) + bucket := tx.Bucket(lowestSignedTargetBucket) + lowestSignedTargetBytes := bucket.Get(publicKey[:]) // 8 because bytesutil.BytesToUint64BigEndian will return 0 if input is less than 8 bytes. - if len(highestSignedTargetBytes) < 8 { + if len(lowestSignedTargetBytes) < 8 { return nil } - highestSignedTargetEpoch = bytesutil.BytesToUint64BigEndian(highestSignedTargetBytes) + lowestSignedTargetEpoch = bytesutil.BytesToUint64BigEndian(lowestSignedTargetBytes) return nil }) - return highestSignedTargetEpoch, err + return lowestSignedTargetEpoch, err } -// SaveHighestSignedSourceEpoch saves the highest signed source epoch for a validator public key. -func (store *Store) SaveHighestSignedSourceEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error { - ctx, span := trace.StartSpan(ctx, "Validator.SaveHighestSignedSourceEpoch") +// SaveLowestSignedSourceEpoch saves the lowest signed source epoch for a validator public key. +func (store *Store) SaveLowestSignedSourceEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error { + ctx, span := trace.StartSpan(ctx, "Validator.SaveLowestSignedSourceEpoch") defer span.End() return store.update(func(tx *bolt.Tx) error { - bucket := tx.Bucket(highestSignedSourceBucket) + bucket := tx.Bucket(lowestSignedSourceBucket) - // If the incoming epoch is higher than the highest signed epoch, override. - highestSignedSourceBytes := bucket.Get(publicKey[:]) - var highestSignedSourceEpoch uint64 - if len(highestSignedSourceBytes) >= 8 { - highestSignedSourceEpoch = bytesutil.BytesToUint64BigEndian(highestSignedSourceBytes) + // If the incoming epoch is lower than the lowest signed epoch, override. + lowestSignedSourceBytes := bucket.Get(publicKey[:]) + var lowestSignedSourceEpoch uint64 + if len(lowestSignedSourceBytes) >= 8 { + lowestSignedSourceEpoch = bytesutil.BytesToUint64BigEndian(lowestSignedSourceBytes) } - if len(highestSignedSourceBytes) == 0 || epoch > highestSignedSourceEpoch { + if len(lowestSignedSourceBytes) == 0 || epoch < lowestSignedSourceEpoch { if err := bucket.Put(publicKey[:], bytesutil.Uint64ToBytesBigEndian(epoch)); err != nil { return err } @@ -154,21 +154,21 @@ func (store *Store) SaveHighestSignedSourceEpoch(ctx context.Context, publicKey }) } -// SaveHighestSignedTargetEpoch saves the highest signed target epoch for a validator public key. -func (store *Store) SaveHighestSignedTargetEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error { - ctx, span := trace.StartSpan(ctx, "Validator.SaveHighestSignedTargetEpoch") +// SaveLowestSignedTargetEpoch saves the lowest signed target epoch for a validator public key. +func (store *Store) SaveLowestSignedTargetEpoch(ctx context.Context, publicKey [48]byte, epoch uint64) error { + ctx, span := trace.StartSpan(ctx, "Validator.SaveLowestSignedTargetEpoch") defer span.End() return store.update(func(tx *bolt.Tx) error { - bucket := tx.Bucket(highestSignedTargetBucket) + bucket := tx.Bucket(lowestSignedTargetBucket) - // If the incoming epoch is higher than the highest signed epoch, override. - highestSignedTargetBytes := bucket.Get(publicKey[:]) - var highestSignedTargetEpoch uint64 - if len(highestSignedTargetBytes) >= 8 { - highestSignedTargetEpoch = bytesutil.BytesToUint64BigEndian(highestSignedTargetBytes) + // If the incoming epoch is lower than the lowest signed epoch, override. + lowestSignedTargetBytes := bucket.Get(publicKey[:]) + var lowestSignedTargetEpoch uint64 + if len(lowestSignedTargetBytes) >= 8 { + lowestSignedTargetEpoch = bytesutil.BytesToUint64BigEndian(lowestSignedTargetBytes) } - if len(highestSignedTargetBytes) == 0 || epoch > highestSignedTargetEpoch { + if len(lowestSignedTargetBytes) == 0 || epoch < lowestSignedTargetEpoch { if err := bucket.Put(publicKey[:], bytesutil.Uint64ToBytesBigEndian(epoch)); err != nil { return err } diff --git a/validator/db/kv/attestation_history_v2_test.go b/validator/db/kv/attestation_history_v2_test.go index 1b49fe14e4..4e2f2c1dcb 100644 --- a/validator/db/kv/attestation_history_v2_test.go +++ b/validator/db/kv/attestation_history_v2_test.go @@ -94,7 +94,7 @@ func TestStore_AttestedPublicKeys(t *testing.T) { assert.DeepEqual(t, [][48]byte{pubKey}, keys) } -func TestHighestSignedSourceEpoch_SaveRetrieve(t *testing.T) { +func TestLowestSignedSourceEpoch_SaveRetrieve(t *testing.T) { ctx := context.Background() validatorDB, err := NewKVStore(t.TempDir(), nil) require.NoError(t, err, "Failed to instantiate DB") @@ -105,37 +105,37 @@ func TestHighestSignedSourceEpoch_SaveRetrieve(t *testing.T) { p0 := [48]byte{0} p1 := [48]byte{1} // Can save. - require.NoError(t, validatorDB.SaveHighestSignedSourceEpoch(ctx, p0, 100)) - require.NoError(t, validatorDB.SaveHighestSignedSourceEpoch(ctx, p1, 200)) - got, err := validatorDB.HighestSignedSourceEpoch(ctx, p0) + require.NoError(t, validatorDB.SaveLowestSignedSourceEpoch(ctx, p0, 100)) + require.NoError(t, validatorDB.SaveLowestSignedSourceEpoch(ctx, p1, 200)) + got, err := validatorDB.LowestSignedSourceEpoch(ctx, p0) require.NoError(t, err) require.Equal(t, uint64(100), got) - got, err = validatorDB.HighestSignedSourceEpoch(ctx, p1) + got, err = validatorDB.LowestSignedSourceEpoch(ctx, p1) require.NoError(t, err) require.Equal(t, uint64(200), got) // Can replace. - require.NoError(t, validatorDB.SaveHighestSignedSourceEpoch(ctx, p0, 300)) - require.NoError(t, validatorDB.SaveHighestSignedSourceEpoch(ctx, p1, 400)) - got, err = validatorDB.HighestSignedSourceEpoch(ctx, p0) + require.NoError(t, validatorDB.SaveLowestSignedSourceEpoch(ctx, p0, 99)) + require.NoError(t, validatorDB.SaveLowestSignedSourceEpoch(ctx, p1, 199)) + got, err = validatorDB.LowestSignedSourceEpoch(ctx, p0) require.NoError(t, err) - require.Equal(t, uint64(300), got) - got, err = validatorDB.HighestSignedSourceEpoch(ctx, p1) + require.Equal(t, uint64(99), got) + got, err = validatorDB.LowestSignedSourceEpoch(ctx, p1) require.NoError(t, err) - require.Equal(t, uint64(400), got) + require.Equal(t, uint64(199), got) // Can not replace. - require.NoError(t, validatorDB.SaveHighestSignedSourceEpoch(ctx, p0, 1)) - require.NoError(t, validatorDB.SaveHighestSignedSourceEpoch(ctx, p1, 2)) - got, err = validatorDB.HighestSignedSourceEpoch(ctx, p0) + require.NoError(t, validatorDB.SaveLowestSignedSourceEpoch(ctx, p0, 100)) + require.NoError(t, validatorDB.SaveLowestSignedSourceEpoch(ctx, p1, 200)) + got, err = validatorDB.LowestSignedSourceEpoch(ctx, p0) require.NoError(t, err) - require.Equal(t, uint64(300), got) - got, err = validatorDB.HighestSignedSourceEpoch(ctx, p1) + require.Equal(t, uint64(99), got) + got, err = validatorDB.LowestSignedSourceEpoch(ctx, p1) require.NoError(t, err) - require.Equal(t, uint64(400), got) + require.Equal(t, uint64(199), got) } -func TestHighestSignedTargetEpoch_SaveRetrieveReplace(t *testing.T) { +func TestLowestSignedTargetEpoch_SaveRetrieveReplace(t *testing.T) { ctx := context.Background() validatorDB, err := NewKVStore(t.TempDir(), nil) require.NoError(t, err, "Failed to instantiate DB") @@ -146,32 +146,32 @@ func TestHighestSignedTargetEpoch_SaveRetrieveReplace(t *testing.T) { p0 := [48]byte{0} p1 := [48]byte{1} // Can save. - require.NoError(t, validatorDB.SaveHighestSignedTargetEpoch(ctx, p0, 100)) - require.NoError(t, validatorDB.SaveHighestSignedTargetEpoch(ctx, p1, 200)) - got, err := validatorDB.HighestSignedTargetEpoch(ctx, p0) + require.NoError(t, validatorDB.SaveLowestSignedTargetEpoch(ctx, p0, 100)) + require.NoError(t, validatorDB.SaveLowestSignedTargetEpoch(ctx, p1, 200)) + got, err := validatorDB.LowestSignedTargetEpoch(ctx, p0) require.NoError(t, err) require.Equal(t, uint64(100), got) - got, err = validatorDB.HighestSignedTargetEpoch(ctx, p1) + got, err = validatorDB.LowestSignedTargetEpoch(ctx, p1) require.NoError(t, err) require.Equal(t, uint64(200), got) // Can replace. - require.NoError(t, validatorDB.SaveHighestSignedTargetEpoch(ctx, p0, 300)) - require.NoError(t, validatorDB.SaveHighestSignedTargetEpoch(ctx, p1, 400)) - got, err = validatorDB.HighestSignedTargetEpoch(ctx, p0) + require.NoError(t, validatorDB.SaveLowestSignedTargetEpoch(ctx, p0, 99)) + require.NoError(t, validatorDB.SaveLowestSignedTargetEpoch(ctx, p1, 199)) + got, err = validatorDB.LowestSignedTargetEpoch(ctx, p0) require.NoError(t, err) - require.Equal(t, uint64(300), got) - got, err = validatorDB.HighestSignedTargetEpoch(ctx, p1) + require.Equal(t, uint64(99), got) + got, err = validatorDB.LowestSignedTargetEpoch(ctx, p1) require.NoError(t, err) - require.Equal(t, uint64(400), got) + require.Equal(t, uint64(199), got) // Can not replace. - require.NoError(t, validatorDB.SaveHighestSignedTargetEpoch(ctx, p0, 1)) - require.NoError(t, validatorDB.SaveHighestSignedTargetEpoch(ctx, p1, 2)) - got, err = validatorDB.HighestSignedTargetEpoch(ctx, p0) + require.NoError(t, validatorDB.SaveLowestSignedTargetEpoch(ctx, p0, 100)) + require.NoError(t, validatorDB.SaveLowestSignedTargetEpoch(ctx, p1, 200)) + got, err = validatorDB.LowestSignedTargetEpoch(ctx, p0) require.NoError(t, err) - require.Equal(t, uint64(300), got) - got, err = validatorDB.HighestSignedTargetEpoch(ctx, p1) + require.Equal(t, uint64(99), got) + got, err = validatorDB.LowestSignedTargetEpoch(ctx, p1) require.NoError(t, err) - require.Equal(t, uint64(400), got) + require.Equal(t, uint64(199), got) } diff --git a/validator/db/kv/db.go b/validator/db/kv/db.go index 14ea6d09a2..ad1b2d9371 100644 --- a/validator/db/kv/db.go +++ b/validator/db/kv/db.go @@ -87,8 +87,8 @@ func NewKVStore(dirPath string, pubKeys [][48]byte) (*Store, error) { historicAttestationsBucket, newHistoricAttestationsBucket, newHistoricProposalsBucket, - highestSignedSourceBucket, - highestSignedTargetBucket, + lowestSignedSourceBucket, + lowestSignedTargetBucket, lowestSignedProposalsBucket, highestSignedProposalsBucket, ) diff --git a/validator/db/kv/schema.go b/validator/db/kv/schema.go index 8477e74803..a05862c5e4 100644 --- a/validator/db/kv/schema.go +++ b/validator/db/kv/schema.go @@ -13,9 +13,9 @@ var ( // New Validator slashing protection from slashable attestations. newHistoricAttestationsBucket = []byte("attestation-history-bucket-interchange") - // Buckets for highest signed source and target epoch for individual validator. - highestSignedSourceBucket = []byte("highest-signed-source-bucket") - highestSignedTargetBucket = []byte("highest-signed-target-bucket") + // Buckets for lowest signed source and target epoch for individual validator. + lowestSignedSourceBucket = []byte("lowest-signed-source-bucket") + lowestSignedTargetBucket = []byte("lowest-signed-target-bucket") // Lowest and highest signed proposals. lowestSignedProposalsBucket = []byte("lowest-signed-proposals-bucket") diff --git a/validator/slashing-protection/local/standard-protection-format/import.go b/validator/slashing-protection/local/standard-protection-format/import.go index aca2d74887..6b4c83a7b5 100644 --- a/validator/slashing-protection/local/standard-protection-format/import.go +++ b/validator/slashing-protection/local/standard-protection-format/import.go @@ -92,7 +92,7 @@ func ImportStandardProtectionJSON(ctx context.Context, validatorDB db.Database, return errors.Wrap(err, "could not save attesting history from imported JSON to database") } - return saveHighestSourceTargetToDB(ctx, validatorDB, signedAttsByPubKey) + return saveLowestSourceTargetToDB(ctx, validatorDB, signedAttsByPubKey) } func validateMetadata(ctx context.Context, validatorDB db.Database, interchangeJSON *EIPSlashingProtectionFormat) error { @@ -253,10 +253,10 @@ func transformSignedAttestations(ctx context.Context, atts []*SignedAttestation) return &attestingHistory, nil } -// This saves the highest source and target epoch from the individual validator to the DB. -func saveHighestSourceTargetToDB(ctx context.Context, validatorDB db.Database, signedAttsByPubKey map[[48]byte][]*SignedAttestation) error { - validatorHighestSourceEpoch := make(map[[48]byte]uint64) // Validator public key to highest attested source epoch. - validatorHighestTargetEpoch := make(map[[48]byte]uint64) // Validator public key to highest attested target epoch. +// This saves the lowest source and target epoch from the individual validator to the DB. +func saveLowestSourceTargetToDB(ctx context.Context, validatorDB db.Database, signedAttsByPubKey map[[48]byte][]*SignedAttestation) error { + validatorLowestSourceEpoch := make(map[[48]byte]uint64) // Validator public key to lowest attested source epoch. + validatorLowestTargetEpoch := make(map[[48]byte]uint64) // Validator public key to lowest attested target epoch. for pubKey, signedAtts := range signedAttsByPubKey { for _, att := range signedAtts { source, err := uint64FromString(att.SourceEpoch) @@ -267,34 +267,34 @@ func saveHighestSourceTargetToDB(ctx context.Context, validatorDB db.Database, s if err != nil { return fmt.Errorf("%d is not a valid target: %v", target, err) } - se, ok := validatorHighestSourceEpoch[pubKey] + se, ok := validatorLowestSourceEpoch[pubKey] if !ok { - validatorHighestSourceEpoch[pubKey] = source - } else if source > se { - validatorHighestSourceEpoch[pubKey] = source + validatorLowestSourceEpoch[pubKey] = source + } else if source < se { + validatorLowestSourceEpoch[pubKey] = source } - te, ok := validatorHighestTargetEpoch[pubKey] + te, ok := validatorLowestTargetEpoch[pubKey] if !ok { - validatorHighestTargetEpoch[pubKey] = target - } else if target > te { - validatorHighestTargetEpoch[pubKey] = target + validatorLowestTargetEpoch[pubKey] = target + } else if target < te { + validatorLowestTargetEpoch[pubKey] = target } } } // This should not happen. - if len(validatorHighestTargetEpoch) != len(validatorHighestSourceEpoch) { + if len(validatorLowestTargetEpoch) != len(validatorLowestSourceEpoch) { return errors.New("incorrect source and target map length") } - // Save highest source and target epoch to DB for every validator in the map. - for k, v := range validatorHighestSourceEpoch { - if err := validatorDB.SaveHighestSignedSourceEpoch(ctx, k, v); err != nil { + // Save lowest source and target epoch to DB for every validator in the map. + for k, v := range validatorLowestSourceEpoch { + if err := validatorDB.SaveLowestSignedSourceEpoch(ctx, k, v); err != nil { return err } } - for k, v := range validatorHighestTargetEpoch { - if err := validatorDB.SaveHighestSignedTargetEpoch(ctx, k, v); err != nil { + for k, v := range validatorLowestTargetEpoch { + if err := validatorDB.SaveLowestSignedTargetEpoch(ctx, k, v); err != nil { return err } } diff --git a/validator/slashing-protection/local/standard-protection-format/import_test.go b/validator/slashing-protection/local/standard-protection-format/import_test.go index 01e32d930d..6559204601 100644 --- a/validator/slashing-protection/local/standard-protection-format/import_test.go +++ b/validator/slashing-protection/local/standard-protection-format/import_test.go @@ -744,7 +744,7 @@ func Test_parseUniqueSignedAttestationsByPubKey(t *testing.T) { } } -func Test_saveHighestSourceTargetToDBt_Ok(t *testing.T) { +func Test_saveLowestSourceTargetToDBt_Ok(t *testing.T) { ctx := context.Background() numValidators := 2 publicKeys := createRandomPubKeys(t, numValidators) @@ -753,20 +753,20 @@ func Test_saveHighestSourceTargetToDBt_Ok(t *testing.T) { m := make(map[[48]byte][]*SignedAttestation) m[publicKeys[0]] = []*SignedAttestation{{SourceEpoch: "1", TargetEpoch: "2"}, {SourceEpoch: "3", TargetEpoch: "4"}} m[publicKeys[1]] = []*SignedAttestation{{SourceEpoch: "8", TargetEpoch: "7"}, {SourceEpoch: "6", TargetEpoch: "5"}} - require.NoError(t, saveHighestSourceTargetToDB(ctx, validatorDB, m)) + require.NoError(t, saveLowestSourceTargetToDB(ctx, validatorDB, m)) - got, err := validatorDB.HighestSignedTargetEpoch(ctx, publicKeys[0]) + got, err := validatorDB.LowestSignedTargetEpoch(ctx, publicKeys[0]) require.NoError(t, err) - require.Equal(t, uint64(4), got) - got, err = validatorDB.HighestSignedTargetEpoch(ctx, publicKeys[1]) + require.Equal(t, uint64(2), got) + got, err = validatorDB.LowestSignedTargetEpoch(ctx, publicKeys[1]) require.NoError(t, err) - require.Equal(t, uint64(7), got) - got, err = validatorDB.HighestSignedSourceEpoch(ctx, publicKeys[0]) + require.Equal(t, uint64(5), got) + got, err = validatorDB.LowestSignedSourceEpoch(ctx, publicKeys[0]) require.NoError(t, err) - require.Equal(t, uint64(3), got) - got, err = validatorDB.HighestSignedSourceEpoch(ctx, publicKeys[1]) + require.Equal(t, uint64(1), got) + got, err = validatorDB.LowestSignedSourceEpoch(ctx, publicKeys[1]) require.NoError(t, err) - require.Equal(t, uint64(8), got) + require.Equal(t, uint64(6), got) } func mockSlashingProtectionJSON(