github.com/neatio-net/neatio@v1.7.3-0.20231114194659-f4d7a2226baa/chain/core/vm/gas.go (about) 1 package vm 2 3 import ( 4 "math/big" 5 ) 6 7 const ( 8 GasQuickStep uint64 = 2 9 GasFastestStep uint64 = 3 10 GasFastStep uint64 = 5 11 GasMidStep uint64 = 8 12 GasSlowStep uint64 = 10 13 GasExtStep uint64 = 20 14 ) 15 16 func callGas(isEip150 bool, availableGas, base uint64, callCost *big.Int) (uint64, error) { 17 if isEip150 { 18 availableGas = availableGas - base 19 gas := availableGas - availableGas/64 20 21 if !callCost.IsUint64() || gas < callCost.Uint64() { 22 return gas, nil 23 } 24 } 25 if !callCost.IsUint64() { 26 return 0, errGasUintOverflow 27 } 28 29 return callCost.Uint64(), nil 30 }