Skip to content

Commit

Permalink
fix:uint64 overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
leonz789 committed Oct 17, 2024
1 parent e3e51b4 commit bf8f646
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions x/oracle/keeper/prices.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ func (k Keeper) GetPrices(
val.TokenID = tokenID
val.NextRoundID = nextRoundID
var i uint64
// i := max(1, nextRoundID-uint64(common.MaxSizePrices))
if i = nextRoundID - uint64(common.MaxSizePrices); i < 1 {
if nextRoundID <= uint64(common.MaxSizePrices) {
i = 1
val.PriceList = make([]*types.PriceTimeRound, nextRoundID)
} else {
i = nextRoundID - uint64(common.MaxSizePrices)
val.PriceList = make([]*types.PriceTimeRound, common.MaxSizePrices)
}
// 0 roundId is reserved, expect the roundid corresponds to the slice index
Expand Down

0 comments on commit bf8f646

Please sign in to comment.