mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
Check block attestation length for operation pool (#7420)
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
This commit is contained in:
parent
63c1057ae6
commit
690fa12f1a
@ -25,7 +25,7 @@ func (p *AttCaches) SaveBlockAttestation(att *ethpb.Attestation) error {
|
||||
|
||||
// Ensure that this attestation is not already fully contained in an existing attestation.
|
||||
for _, a := range atts {
|
||||
if a.AggregationBits.Contains(att.AggregationBits) {
|
||||
if a.AggregationBits.Len() == att.AggregationBits.Len() && a.AggregationBits.Contains(att.AggregationBits) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,8 @@ func TestKV_BlockAttestation_CanSaveRetrieve(t *testing.T) {
|
||||
att1 := ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1, BeaconBlockRoot: make([]byte, 32), Target: ðpb.Checkpoint{Root: make([]byte, 32)}, Source: ðpb.Checkpoint{Root: make([]byte, 32)}}, AggregationBits: bitfield.Bitlist{0b1101}}
|
||||
att2 := ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2, BeaconBlockRoot: make([]byte, 32), Target: ðpb.Checkpoint{Root: make([]byte, 32)}, Source: ðpb.Checkpoint{Root: make([]byte, 32)}}, AggregationBits: bitfield.Bitlist{0b1101}}
|
||||
att3 := ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3, BeaconBlockRoot: make([]byte, 32), Target: ðpb.Checkpoint{Root: make([]byte, 32)}, Source: ðpb.Checkpoint{Root: make([]byte, 32)}}, AggregationBits: bitfield.Bitlist{0b1101}}
|
||||
atts := []*ethpb.Attestation{att1, att2, att3}
|
||||
att4 := ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3, BeaconBlockRoot: make([]byte, 32), Target: ðpb.Checkpoint{Root: make([]byte, 32)}, Source: ðpb.Checkpoint{Root: make([]byte, 32)}}, AggregationBits: bitfield.Bitlist{0b11011}} // Diff bit length should not panic.
|
||||
atts := []*ethpb.Attestation{att1, att2, att3, att4}
|
||||
|
||||
for _, att := range atts {
|
||||
require.NoError(t, cache.SaveBlockAttestation(att))
|
||||
|
Loading…
Reference in New Issue
Block a user