diff --git a/beacon-chain/operations/attestations/kv/aggregated_test.go b/beacon-chain/operations/attestations/kv/aggregated_test.go index ab4ad9220..b83f1303a 100644 --- a/beacon-chain/operations/attestations/kv/aggregated_test.go +++ b/beacon-chain/operations/attestations/kv/aggregated_test.go @@ -477,8 +477,10 @@ func TestKV_Aggregated_HasAggregatedAttestation(t *testing.T) { // Same test for block attestations cache = NewAttCaches() - assert.NoError(t, cache.SaveBlockAttestations(tt.existing)) + for _, att := range tt.existing { + require.NoError(t, cache.SaveBlockAttestation(att)) + } result, err = cache.HasAggregatedAttestation(tt.input) require.NoError(t, err) assert.Equal(t, tt.want, result) diff --git a/beacon-chain/operations/attestations/kv/block.go b/beacon-chain/operations/attestations/kv/block.go index 8235968a3..4d462c62b 100644 --- a/beacon-chain/operations/attestations/kv/block.go +++ b/beacon-chain/operations/attestations/kv/block.go @@ -36,17 +36,6 @@ func (c *AttCaches) SaveBlockAttestation(att *ethpb.Attestation) error { return nil } -// SaveBlockAttestations saves a list of block attestations in cache. -func (c *AttCaches) SaveBlockAttestations(atts []*ethpb.Attestation) error { - for _, att := range atts { - if err := c.SaveBlockAttestation(att); err != nil { - return err - } - } - - return nil -} - // BlockAttestations returns the block attestations in cache. func (c *AttCaches) BlockAttestations() []*ethpb.Attestation { atts := make([]*ethpb.Attestation, 0) diff --git a/beacon-chain/operations/attestations/pool.go b/beacon-chain/operations/attestations/pool.go index 145b6a3f4..5a9c940f0 100644 --- a/beacon-chain/operations/attestations/pool.go +++ b/beacon-chain/operations/attestations/pool.go @@ -32,7 +32,6 @@ type Pool interface { UnaggregatedAttestationCount() int // For attestations that were included in the block. SaveBlockAttestation(att *ethpb.Attestation) error - SaveBlockAttestations(atts []*ethpb.Attestation) error BlockAttestations() []*ethpb.Attestation DeleteBlockAttestation(att *ethpb.Attestation) error // For attestations to be passed to fork choice. diff --git a/beacon-chain/operations/attestations/prepare_forkchoice_test.go b/beacon-chain/operations/attestations/prepare_forkchoice_test.go index 89ea6e291..174947fc8 100644 --- a/beacon-chain/operations/attestations/prepare_forkchoice_test.go +++ b/beacon-chain/operations/attestations/prepare_forkchoice_test.go @@ -94,7 +94,9 @@ func TestBatchAttestations_Multiple(t *testing.T) { } require.NoError(t, s.cfg.Pool.SaveUnaggregatedAttestations(unaggregatedAtts)) require.NoError(t, s.cfg.Pool.SaveAggregatedAttestations(aggregatedAtts)) - require.NoError(t, s.cfg.Pool.SaveBlockAttestations(blockAtts)) + for _, att := range blockAtts { + require.NoError(t, s.cfg.Pool.SaveBlockAttestation(att)) + } require.NoError(t, s.batchForkChoiceAtts(context.Background())) wanted, err := attaggregation.Aggregate([]*ethpb.Attestation{aggregatedAtts[0], blockAtts[0]}) @@ -148,7 +150,10 @@ func TestBatchAttestations_Single(t *testing.T) { } require.NoError(t, s.cfg.Pool.SaveUnaggregatedAttestations(unaggregatedAtts)) require.NoError(t, s.cfg.Pool.SaveAggregatedAttestations(aggregatedAtts)) - require.NoError(t, s.cfg.Pool.SaveBlockAttestations(blockAtts)) + + for _, att := range blockAtts { + require.NoError(t, s.cfg.Pool.SaveBlockAttestation(att)) + } require.NoError(t, s.batchForkChoiceAtts(context.Background())) wanted, err := attaggregation.Aggregate(append(aggregatedAtts, unaggregatedAtts...)) diff --git a/beacon-chain/operations/attestations/prune_expired_test.go b/beacon-chain/operations/attestations/prune_expired_test.go index 88e338685..4b125f7c1 100644 --- a/beacon-chain/operations/attestations/prune_expired_test.go +++ b/beacon-chain/operations/attestations/prune_expired_test.go @@ -42,7 +42,9 @@ func TestPruneExpired_Ticker(t *testing.T) { } require.NoError(t, s.cfg.Pool.SaveAggregatedAttestations(atts)) assert.Equal(t, 2, s.cfg.Pool.AggregatedAttestationCount()) - require.NoError(t, s.cfg.Pool.SaveBlockAttestations(atts)) + for _, att := range atts { + require.NoError(t, s.cfg.Pool.SaveBlockAttestation(att)) + } // Rewind back one epoch worth of time. s.genesisTime = uint64(prysmTime.Now().Unix()) - uint64(params.BeaconConfig().SlotsPerEpoch.Mul(params.BeaconConfig().SecondsPerSlot)) @@ -95,7 +97,9 @@ func TestPruneExpired_PruneExpiredAtts(t *testing.T) { att4 := ðpb.Attestation{Data: ad2, AggregationBits: bitfield.Bitlist{0b1110}} atts := []*ethpb.Attestation{att1, att2, att3, att4} require.NoError(t, s.cfg.Pool.SaveAggregatedAttestations(atts)) - require.NoError(t, s.cfg.Pool.SaveBlockAttestations(atts)) + for _, att := range atts { + require.NoError(t, s.cfg.Pool.SaveBlockAttestation(att)) + } // Rewind back one epoch worth of time. s.genesisTime = uint64(prysmTime.Now().Unix()) - uint64(params.BeaconConfig().SlotsPerEpoch.Mul(params.BeaconConfig().SecondsPerSlot))