Skip to content

Commit

Permalink
fix: round up when calculating fee in txsim (backport #2239) (#2240)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Aug 10, 2023
1 parent ebb8da9 commit 118f7a8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/txsim/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package txsim
import (
"context"
"fmt"
"math"
"strings"
"sync"

Expand Down Expand Up @@ -183,9 +184,9 @@ func (am *AccountManager) Submit(ctx context.Context, op Operation) error {
} else {
builder.SetGasLimit(op.GasLimit)
if op.GasPrice > 0 {
builder.SetFeeAmount(types.NewCoins(types.NewInt64Coin(app.BondDenom, int64(float64(op.GasLimit)*op.GasPrice))))
builder.SetFeeAmount(types.NewCoins(types.NewInt64Coin(app.BondDenom, int64(math.Ceil(float64(op.GasLimit)*op.GasPrice)))))
} else {
builder.SetFeeAmount(types.NewCoins(types.NewInt64Coin(app.BondDenom, int64(float64(op.GasLimit)*appconsts.DefaultMinGasPrice))))
builder.SetFeeAmount(types.NewCoins(types.NewInt64Coin(app.BondDenom, int64(math.Ceil(float64(op.GasLimit)*appconsts.DefaultMinGasPrice)))))
}
}

Expand Down

0 comments on commit 118f7a8

Please sign in to comment.