Skip to content

Commit 6e00db4

Browse files
authoredMar 3, 2025
cache uses wrong seen committee index for electra (#14998)
* adding fix and unit tests * removing unneeded test for now, will handle in separate PR
1 parent c6344e7 commit 6e00db4

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed
 

‎beacon-chain/sync/pending_attestations_queue.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func (s *Service) processUnaggregated(ctx context.Context, att ethpb.Att) {
197197
return
198198
}
199199
}
200-
s.setSeenCommitteeIndicesSlot(data.Slot, data.CommitteeIndex, att.GetAggregationBits())
200+
s.setSeenCommitteeIndicesSlot(data.Slot, att.GetCommitteeIndex(), att.GetAggregationBits())
201201

202202
valCount, err := helpers.ActiveValidatorCount(ctx, preState, slots.ToEpoch(data.Slot))
203203
if err != nil {

‎beacon-chain/sync/pending_attestations_queue_test.go

+38
Original file line numberDiff line numberDiff line change
@@ -706,3 +706,41 @@ func Test_attsAreEqual_Committee(t *testing.T) {
706706
assert.Equal(t, false, attsAreEqual(att1, att2))
707707
})
708708
}
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Fixed
2+
3+
- fix inserting the wrong committee index into the seen cache for electra attestations

0 commit comments

Comments
 (0)