adding nil checks on attestation interface (#14638)

* adding nil checks on interface

* changelog

* add linting

* adding missed checks

* review feedback

* attestation bits should not be in nil check

* fixing nil checks

* simplifying function

* fixing some missed items

* more missed items

* fixing more tests

* reverting some changes and fixing more tests

* adding in source check back in

* missed test

* sammy's review

* radek feedback
This commit is contained in:
james-prysm
2024-11-18 11:51:17 -06:00
committed by GitHub
parent 00aeea3656
commit a7ba11df37
16 changed files with 129 additions and 70 deletions

View File

@@ -131,10 +131,9 @@ func (s *Store) SaveAttestationForPubKey(
att ethpb.IndexedAtt,
) error {
// If there is no attestation, return on error.
if att == nil || att.GetData() == nil || att.GetData().Source == nil || att.GetData().Target == nil {
if att == nil || att.IsNil() || att.GetData().Source == nil || att.GetData().Target == nil {
return errors.New("incoming attestation does not contain source and/or target epoch")
}
// Get validator slashing protection.
validatorSlashingProtection, err := s.validatorSlashingProtection(pubkey)
if err != nil {