Open
Description
Summary of Bug
If we look at this code
sommelier/x/cellarfees/keeper/abci.go
Lines 19 to 28 in 3157d97
we see that in the condition to reset the counters, modulus MUST BE == 0!
This means that if modulus != 0
regardless of how many times that we iterate, we can't be performing a counter reset and this means that that loop is needlessly burning CPU cycles whenever it isn't an auction interval
Suggestion
Simply firstly check that the auction interval occured and even better rename to a much better variable so
atAuctionInterval := (ctx.BlockHeader().Height % int64(cellarfeesParams.AuctionInterval)) == 0
if atAuctionInterval {
for _, counter := range counters.Counters {
if counter.Count < cellarfeesParams.FeeAccrualAuctionThreshold {
continue
}
if k.beginAuction(ctx, counter.Denom) {
counters.ResetCounter(counter.Denom)
}
}
}
Metadata
Metadata
Assignees
Labels
No labels