Skip to content

Commit

Permalink
add checking zero gas to prevent panic (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 authored Jun 7, 2024
1 parent 530f377 commit 985ce5e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions x/move/ante/gas_prices.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ func (d GasPricesDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool
gas := feeTx.GetGas()

if !simulate {
if gas == 0 {
return ctx, errors.Wrap(sdkerrors.ErrOutOfGas, "Transaction gas cannot be zero.")
}

// CSR: store a tx gas prices
ctx = ctx.WithValue(GasPricesContextKey, sdk.NewDecCoinsFromCoins(feeCoins...).QuoDec(math.LegacyNewDec(int64(gas))))
}
Expand Down

0 comments on commit 985ce5e

Please sign in to comment.