2022-03-14 20:58:13 +00:00
|
|
|
//go:build fuzz
|
2020-09-14 18:42:08 +00:00
|
|
|
|
|
|
|
// This file is used in fuzzer builds to bypass global committee caches.
|
|
|
|
package cache
|
|
|
|
|
2021-09-26 15:27:57 +00:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2023-03-17 18:52:56 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
2021-09-26 15:27:57 +00:00
|
|
|
)
|
2021-02-16 07:45:34 +00:00
|
|
|
|
2020-09-14 18:42:08 +00:00
|
|
|
// FakeCommitteeCache is a struct with 1 queue for looking up shuffled indices list by seed.
|
|
|
|
type FakeCommitteeCache struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewCommitteesCache creates a new committee cache for storing/accessing shuffled indices of a committee.
|
|
|
|
func NewCommitteesCache() *FakeCommitteeCache {
|
|
|
|
return &FakeCommitteeCache{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Committee fetches the shuffled indices by slot and committee index. Every list of indices
|
|
|
|
// represent one committee. Returns true if the list exists with slot and committee index. Otherwise returns false, nil.
|
2023-01-26 14:40:12 +00:00
|
|
|
func (c *FakeCommitteeCache) Committee(ctx context.Context, slot primitives.Slot, seed [32]byte, index primitives.CommitteeIndex) ([]primitives.ValidatorIndex, error) {
|
2020-09-14 18:42:08 +00:00
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// AddCommitteeShuffledList adds Committee shuffled list object to the cache. T
|
|
|
|
// his method also trims the least recently list if the cache size has ready the max cache size limit.
|
2022-05-31 00:38:37 +00:00
|
|
|
func (c *FakeCommitteeCache) AddCommitteeShuffledList(ctx context.Context, committees *Committees) error {
|
2020-09-14 18:42:08 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// AddProposerIndicesList updates the committee shuffled list with proposer indices.
|
2023-01-26 14:40:12 +00:00
|
|
|
func (c *FakeCommitteeCache) AddProposerIndicesList(seed [32]byte, indices []primitives.ValidatorIndex) error {
|
2020-09-14 18:42:08 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// ActiveIndices returns the active indices of a given seed stored in cache.
|
2023-01-26 14:40:12 +00:00
|
|
|
func (c *FakeCommitteeCache) ActiveIndices(ctx context.Context, seed [32]byte) ([]primitives.ValidatorIndex, error) {
|
2020-09-14 18:42:08 +00:00
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// ActiveIndicesCount returns the active indices count of a given seed stored in cache.
|
2021-09-26 15:27:57 +00:00
|
|
|
func (c *FakeCommitteeCache) ActiveIndicesCount(ctx context.Context, seed [32]byte) (int, error) {
|
2020-09-14 18:42:08 +00:00
|
|
|
return 0, nil
|
|
|
|
}
|
|
|
|
|
2021-08-12 05:04:40 +00:00
|
|
|
// ActiveBalance returns the active balance of a given seed stored in cache.
|
|
|
|
func (c *FakeCommitteeCache) ActiveBalance(seed [32]byte) (uint64, error) {
|
|
|
|
return 0, nil
|
|
|
|
}
|
|
|
|
|
2020-09-14 18:42:08 +00:00
|
|
|
// ProposerIndices returns the proposer indices of a given seed.
|
2023-01-26 14:40:12 +00:00
|
|
|
func (c *FakeCommitteeCache) ProposerIndices(seed [32]byte) ([]primitives.ValidatorIndex, error) {
|
2020-09-14 18:42:08 +00:00
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// HasEntry returns true if the committee cache has a value.
|
|
|
|
func (c *FakeCommitteeCache) HasEntry(string) bool {
|
|
|
|
return false
|
|
|
|
}
|
2021-09-26 15:27:57 +00:00
|
|
|
|
|
|
|
// MarkInProgress is a stub.
|
|
|
|
func (c *FakeCommitteeCache) MarkInProgress(seed [32]byte) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// MarkNotInProgress is a stub.
|
|
|
|
func (c *FakeCommitteeCache) MarkNotInProgress(seed [32]byte) error {
|
|
|
|
return nil
|
|
|
|
}
|
2023-04-27 00:50:04 +00:00
|
|
|
|
|
|
|
// Clear is a stub.
|
|
|
|
func (c *FakeCommitteeCache) Clear() {
|
|
|
|
return
|
|
|
|
}
|