|
| 1 | +// +build libfuzzer |
| 2 | + |
| 3 | +// This file is used in fuzzer builds to bypass global committee caches. |
| 4 | +package cache |
| 5 | + |
| 6 | +// FakeCommitteeCache is a struct with 1 queue for looking up shuffled indices list by seed. |
| 7 | +type FakeCommitteeCache struct { |
| 8 | +} |
| 9 | + |
| 10 | +// NewCommitteesCache creates a new committee cache for storing/accessing shuffled indices of a committee. |
| 11 | +func NewCommitteesCache() *FakeCommitteeCache { |
| 12 | + return &FakeCommitteeCache{} |
| 13 | +} |
| 14 | + |
| 15 | +// Committee fetches the shuffled indices by slot and committee index. Every list of indices |
| 16 | +// represent one committee. Returns true if the list exists with slot and committee index. Otherwise returns false, nil. |
| 17 | +func (c *FakeCommitteeCache) Committee(slot uint64, seed [32]byte, index uint64) ([]uint64, error) { |
| 18 | + return nil, nil |
| 19 | +} |
| 20 | + |
| 21 | +// AddCommitteeShuffledList adds Committee shuffled list object to the cache. T |
| 22 | +// his method also trims the least recently list if the cache size has ready the max cache size limit. |
| 23 | +func (c *FakeCommitteeCache) AddCommitteeShuffledList(committees *Committees) error { |
| 24 | + return nil |
| 25 | +} |
| 26 | + |
| 27 | +// AddProposerIndicesList updates the committee shuffled list with proposer indices. |
| 28 | +func (c *FakeCommitteeCache) AddProposerIndicesList(seed [32]byte, indices []uint64) error { |
| 29 | + return nil |
| 30 | +} |
| 31 | + |
| 32 | +// ActiveIndices returns the active indices of a given seed stored in cache. |
| 33 | +func (c *FakeCommitteeCache) ActiveIndices(seed [32]byte) ([]uint64, error) { |
| 34 | + return nil, nil |
| 35 | +} |
| 36 | + |
| 37 | +// ActiveIndicesCount returns the active indices count of a given seed stored in cache. |
| 38 | +func (c *FakeCommitteeCache) ActiveIndicesCount(seed [32]byte) (int, error) { |
| 39 | + return 0, nil |
| 40 | +} |
| 41 | + |
| 42 | +// ProposerIndices returns the proposer indices of a given seed. |
| 43 | +func (c *FakeCommitteeCache) ProposerIndices(seed [32]byte) ([]uint64, error) { |
| 44 | + return nil, nil |
| 45 | +} |
| 46 | + |
| 47 | +// HasEntry returns true if the committee cache has a value. |
| 48 | +func (c *FakeCommitteeCache) HasEntry(string) bool { |
| 49 | + return false |
| 50 | +} |
0 commit comments