@@ -706,3 +706,41 @@ func Test_attsAreEqual_Committee(t *testing.T) {
706
706
assert .Equal (t , false , attsAreEqual (att1 , att2 ))
707
707
})
708
708
}
709
+
710
+ func Test_SeenCommitteeIndicesSlot (t * testing.T ) {
711
+ t .Run ("phase 0 success" , func (t * testing.T ) {
712
+ s := & Service {
713
+ seenUnAggregatedAttestationCache : lruwrpr .New (1 ),
714
+ }
715
+ data := & ethpb.AttestationData {Slot : 1 , CommitteeIndex : 44 }
716
+ att := & ethpb.Attestation {
717
+ AggregationBits : bitfield.Bitlist {0x01 },
718
+ Data : data ,
719
+ }
720
+ s .setSeenCommitteeIndicesSlot (data .Slot , att .GetCommitteeIndex (), att .GetAggregationBits ())
721
+ b := append (bytesutil .Bytes32 (uint64 (1 )), bytesutil .Bytes32 (uint64 (44 ))... )
722
+ b = append (b , bytesutil .SafeCopyBytes (att .GetAggregationBits ())... )
723
+ _ , ok := s .seenUnAggregatedAttestationCache .Get (string (b ))
724
+ require .Equal (t , true , ok )
725
+ })
726
+ t .Run ("electra success" , func (t * testing.T ) {
727
+ s := & Service {
728
+ seenUnAggregatedAttestationCache : lruwrpr .New (1 ),
729
+ }
730
+ // committee index is 0 post electra for attestation electra
731
+ data := & ethpb.AttestationData {Slot : 1 , CommitteeIndex : 0 }
732
+ cb := primitives .NewAttestationCommitteeBits ()
733
+ cb .SetBitAt (uint64 (63 ), true )
734
+ att := & ethpb.AttestationElectra {
735
+ AggregationBits : bitfield.Bitlist {0x01 },
736
+ Data : data ,
737
+ CommitteeBits : cb ,
738
+ }
739
+ ci := att .GetCommitteeIndex ()
740
+ s .setSeenCommitteeIndicesSlot (data .Slot , ci , att .GetAggregationBits ())
741
+ b := append (bytesutil .Bytes32 (uint64 (1 )), bytesutil .Bytes32 (uint64 (63 ))... )
742
+ b = append (b , bytesutil .SafeCopyBytes (att .GetAggregationBits ())... )
743
+ _ , ok := s .seenUnAggregatedAttestationCache .Get (string (b ))
744
+ require .Equal (t , true , ok )
745
+ })
746
+ }
0 commit comments