mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 18:51:19 +00:00
Update committee cache size to 32 (#7018)
* Update committee cache size to 32 * Merge branch 'master' into update-committee-cache-size * Cache: fixed rotating test * Merge branch 'update-committee-cache-size' of github.com:prysmaticlabs/prysm into update-committee-cache-size * Merge refs/heads/master into update-committee-cache-size * Merge refs/heads/master into update-committee-cache-size * Merge refs/heads/master into update-committee-cache-size
This commit is contained in:
parent
d66f72939e
commit
a2f781522f
5
beacon-chain/cache/committee.go
vendored
5
beacon-chain/cache/committee.go
vendored
@ -17,9 +17,8 @@ var (
|
||||
ErrNotCommittee = errors.New("object is not a committee struct")
|
||||
|
||||
// maxCommitteesCacheSize defines the max number of shuffled committees on per randao basis can cache.
|
||||
// Due to reorgs, it's good to keep the old cache around for quickly switch over. 10 is a generous
|
||||
// cache size as it considers 3 concurrent branches over 3 epochs.
|
||||
maxCommitteesCacheSize = uint64(10)
|
||||
// Due to reorgs and long finality, it's good to keep the old cache around for quickly switch over.
|
||||
maxCommitteesCacheSize = uint64(32)
|
||||
|
||||
// CommitteeCacheMiss tracks the number of committee requests that aren't present in the cache.
|
||||
CommitteeCacheMiss = promauto.NewCounter(prometheus.CounterOpts{
|
||||
|
7
beacon-chain/cache/committee_test.go
vendored
7
beacon-chain/cache/committee_test.go
vendored
@ -122,7 +122,9 @@ func TestCommitteeCache_CanRotate(t *testing.T) {
|
||||
cache := NewCommitteesCache()
|
||||
|
||||
// Should rotate out all the epochs except 190 through 199.
|
||||
for i := 100; i < 200; i++ {
|
||||
start := 100
|
||||
end := 200
|
||||
for i := start; i < end; i++ {
|
||||
s := []byte(strconv.Itoa(i))
|
||||
item := &Committees{Seed: bytesutil.ToBytes32(s)}
|
||||
require.NoError(t, cache.AddCommitteeShuffledList(item))
|
||||
@ -134,7 +136,8 @@ func TestCommitteeCache_CanRotate(t *testing.T) {
|
||||
sort.Slice(k, func(i, j int) bool {
|
||||
return k[i] < k[j]
|
||||
})
|
||||
s := bytesutil.ToBytes32([]byte(strconv.Itoa(190)))
|
||||
wanted := end - int(maxCommitteesCacheSize)
|
||||
s := bytesutil.ToBytes32([]byte(strconv.Itoa(wanted)))
|
||||
assert.Equal(t, key(s), k[0], "incorrect key received for slot 190")
|
||||
|
||||
s = bytesutil.ToBytes32([]byte(strconv.Itoa(199)))
|
||||
|
Loading…
Reference in New Issue
Block a user