Skip to content

Commit

Permalink
fix: round up when calculating fee in txsim (#2239)
Browse files Browse the repository at this point in the history
## Overview

this is a quick bug fix that rounds up when calculating fees in txsim.
Without doing this, the fees used are too low by a single utia

## Checklist

- [x] New and updated code has appropriate documentation
- [x] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [x] Visual proof for any user facing features like CLI or
documentation updates
- [ ] Linked issues closed with keywords
  • Loading branch information
evan-forbes authored Aug 9, 2023
1 parent 58cc279 commit b70048b
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 b70048b

Please sign in to comment.