Skip to content

Commit

Permalink
fix: flooring 1/64 of the gas limit
Browse files Browse the repository at this point in the history
  • Loading branch information
onikonychev committed Dec 28, 2024
1 parent 2665603 commit 60730b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion x/evm/keeper/erc20.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper

import (
"fmt"
"math"
"math/big"

"cosmossdk.io/errors"
Expand Down Expand Up @@ -30,7 +31,7 @@ const (
// protection against recursive calls ERC20 -> precompile -> ERC20.
func getCallGasWithLimit(ctx sdk.Context, gasLimit uint64) uint64 {
availableGas := ctx.GasMeter().GasRemaining()
callGas := (availableGas * 63) / 64
callGas := availableGas - uint64(math.Floor(float64(availableGas)/64))
return min(callGas, gasLimit)
}

Expand Down

0 comments on commit 60730b7

Please sign in to comment.