2022-03-14 20:58:13 +00:00
|
|
|
//go:build fuzz
|
2020-10-07 17:25:08 +00:00
|
|
|
|
|
|
|
// This file is used in fuzzer builds to bypass proposer indices caches.
|
|
|
|
package cache
|
|
|
|
|
2023-03-17 18:52:56 +00:00
|
|
|
import "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
2021-02-23 00:14:50 +00:00
|
|
|
|
2020-10-07 17:25:08 +00:00
|
|
|
// FakeProposerIndicesCache is a struct with 1 queue for looking up proposer indices by root.
|
|
|
|
type FakeProposerIndicesCache struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewProposerIndicesCache creates a new proposer indices cache for storing/accessing proposer index assignments of an epoch.
|
|
|
|
func NewProposerIndicesCache() *FakeProposerIndicesCache {
|
|
|
|
return &FakeProposerIndicesCache{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// AddProposerIndices adds ProposerIndices object to the cache.
|
|
|
|
// This method also trims the least recently list if the cache size has ready the max cache size limit.
|
|
|
|
func (c *FakeProposerIndicesCache) AddProposerIndices(p *ProposerIndices) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// ProposerIndices returns the proposer indices of a block root seed.
|
2023-01-26 14:40:12 +00:00
|
|
|
func (c *FakeProposerIndicesCache) ProposerIndices(r [32]byte) ([]primitives.ValidatorIndex, error) {
|
2020-10-07 17:25:08 +00:00
|
|
|
return nil, nil
|
|
|
|
}
|
2020-12-15 00:09:30 +00:00
|
|
|
|
|
|
|
// HasProposerIndices returns the proposer indices of a block root seed.
|
|
|
|
func (c *FakeProposerIndicesCache) HasProposerIndices(r [32]byte) (bool, error) {
|
|
|
|
return false, nil
|
|
|
|
}
|
2022-05-04 06:15:09 +00:00
|
|
|
|
|
|
|
func (c *FakeProposerIndicesCache) Len() int {
|
|
|
|
return 0
|
|
|
|
}
|
2023-04-27 00:50:04 +00:00
|
|
|
|
|
|
|
// Clear is a stub.
|
|
|
|
func (c *FakeProposerIndicesCache) Clear() {
|
|
|
|
}
|