func ValidatorFromProto(validator *pb.Validator) (*Validator, error) {
	if len(validator.Pubkey) != 96 {
		return nil, errors.New("validator pubkey should be 96 bytes")
	}
	v := &Validator{
		Status:                  validator.Status,
		LatestStatusChangeSlot:  validator.LatestStatusChangeSlot,
		ExitCount:               validator.LatestStatusChangeSlot,
		LastPoCChangeSlot:       validator.LastPoCChangeSlot,
		SecondLastPoCChangeSlot: validator.SecondLastPoCChangeSlot,
	}
	err := v.WithdrawalCredentials.SetBytes(validator.WithdrawalCredentials)
	if err != nil {
		return nil, err
	}
	copy(v.Pubkey[:], validator.Pubkey)

	return v, nil
}
// ValidatorFromProto gets the validator for the protobuf representation
ValidatorFromProto gets the validator for the protobuf representation
// ValidatorFromProto gets the validator for the protobuf representation
func ValidatorFromProto(validator *pb.Validator) (*Validator, error) {
	if len(validator.Pubkey) != 96 {
		return nil, errors.New("validator pubkey should be 96 bytes")
	}
	v := &Validator{
		Status:                  validator.Status,
		LatestStatusChangeSlot:  validator.LatestStatusChangeSlot,
		ExitCount:               validator.LatestStatusChangeSlot,
		LastPoCChangeSlot:       validator.LastPoCChangeSlot,
		SecondLastPoCChangeSlot: validator.SecondLastPoCChangeSlot,
	}
	err := v.WithdrawalCredentials.SetBytes(validator.WithdrawalCredentials)
	if err != nil {
		return nil, err
	}
	copy(v.Pubkey[:], validator.Pubkey)
	return v, nil
}
func ValidatorFromProto ( validator * pb . Validator ) ( * Validator , error ) { if len ( validator . Pubkey ) != 96 { return nil , errors . New ( " " ) } v := & Validator { Status : validator . Status , LatestStatusChangeSlot : validator . LatestStatusChangeSlot , ExitCount : validator . LatestStatusChangeSlot , LastPoCChangeSlot : validator . LastPoCChangeSlot , SecondLastPoCChangeSlot : validator . SecondLastPoCChangeSlot , } err := v . WithdrawalCredentials . SetBytes ( validator . WithdrawalCredentials ) if err != nil { return nil , err } copy ( v . Pubkey [ : ] , validator . Pubkey ) return v , nil }
ValidatorFromProto gets the validator for the protobuf representation
ValidatorFromProto gets the validator for the protobuf representation