Skip to content

Commit

Permalink
fix: avoid int64() usage b/c it may overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp committed Jan 2, 2024
1 parent 617a5e2 commit 925e81b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/posthandler/refund_gas_remaining.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (d RefundGasRemainingDecorator) processRefund(ctx sdk.Context, refund sdk.C
// getRefund returns the coins that should be refunded to the recipient.
func getRefund(gasMeter sdk.GasMeter, feeTx sdk.FeeTx) sdk.Coins {
gasPrice := getGasPrice(feeTx)
toRefund := gasPrice.Amount.MulInt64(int64(gasMeter.GasRemaining())).TruncateInt()
toRefund := gasPrice.Amount.MulInt(sdk.NewIntFromUint64(gasMeter.GasRemaining())).TruncateInt()
maxToRefund := MaxPortionOfFeeToRefund.MulInt(feeTx.GetFee().AmountOf(appconsts.BondDenom)).TruncateInt()
amountToRefund := minimum(toRefund, maxToRefund)
return sdk.NewCoins(sdk.NewCoin(appconsts.BondDenom, amountToRefund))
Expand Down

0 comments on commit 925e81b

Please sign in to comment.