prysm-pulse/beacon-chain/operations/attestations/pool.go
Victor Farazdagi 50af507407
Improves operations/attestations/kv test coverage (#6181)
* fixes span names
* TestKV_SaveUnaggregatedAttestation tests added
* TestKV_SaveUnaggregatedAttestations test
* adds count tests
* TestKV_Unaggregated_CanDelete
* fixes naming
* Merge branch 'master' into att-pool-kv-cleanup
* better naming
* Merge branch 'att-pool-kv-cleanup' of github.com:prysmaticlabs/prysm into att-pool-kv-cleanup
* naming
* TestKV_Aggregated_SaveUnaggregatedAttestation added
* Merge branch 'master' into att-pool-kv-cleanup
* naming
* updates TestKV_Aggregated_HasAggregatedAttestation
* updates delete tests
* fix order
* Merge branch 'master' into att-pool-kv-cleanup
2020-06-09 21:00:36 +00:00

45 lines
1.9 KiB
Go

package attestations
import (
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
"github.com/prysmaticlabs/prysm/beacon-chain/operations/attestations/kv"
)
// Pool defines the necessary methods for Prysm attestations pool to serve
// fork choice and validators. In the current design, aggregated attestations
// are used by proposer actor. Unaggregated attestations are used by
// aggregator actor.
type Pool interface {
// For Aggregated attestations
AggregateUnaggregatedAttestations() error
SaveAggregatedAttestation(att *ethpb.Attestation) error
SaveAggregatedAttestations(atts []*ethpb.Attestation) error
AggregatedAttestations() []*ethpb.Attestation
AggregatedAttestationsBySlotIndex(slot uint64, committeeIndex uint64) []*ethpb.Attestation
DeleteAggregatedAttestation(att *ethpb.Attestation) error
HasAggregatedAttestation(att *ethpb.Attestation) (bool, error)
AggregatedAttestationCount() int
// For unaggregated attestations.
SaveUnaggregatedAttestation(att *ethpb.Attestation) error
SaveUnaggregatedAttestations(atts []*ethpb.Attestation) error
UnaggregatedAttestations() []*ethpb.Attestation
UnaggregatedAttestationsBySlotIndex(slot uint64, committeeIndex uint64) []*ethpb.Attestation
DeleteUnaggregatedAttestation(att *ethpb.Attestation) error
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.
SaveForkchoiceAttestation(att *ethpb.Attestation) error
SaveForkchoiceAttestations(atts []*ethpb.Attestation) error
ForkchoiceAttestations() []*ethpb.Attestation
DeleteForkchoiceAttestation(att *ethpb.Attestation) error
}
// NewPool initializes a new attestation pool.
func NewPool() *kv.AttCaches {
return kv.NewAttCaches()
}